Revision history for IncludeAction


Revision [18711]

Last edited on 2008-01-28 00:12:33 by CyneBeald [Modified links pointing to docs server]

No Differences

Revision [12367]

Edited on 2005-12-21 10:49:36 by CyneBeald [Fixed version that doesn't rely on the DB being case insensitive]
Additions:
=====Include other pages=====
The following action includes another wikipage and takes care not to be trapped in a circular reference, i.e. included pages can include other pages without running into trouble.

<<actions/include.php<<::c::

%%(php)
<?php
if (!$page) $page = $wikka_vars;
$page = strtolower($page);
if (!$this->config["includes"]) $this->config["includes"][] = strtolower($this->tag);

if (!in_array($page, $this->config["includes"]) && $page != $this->tag) {
if ($this->HasAccess("read", $page)) {
$this->config["includes"][] = $page;
$page = $this->LoadPage($page);

print $this->Format($page["body"]);
}
} else print "<span class='error'>Circular reference detected</span>";
?>
%%

-----

Thanks, Sebastian. Seems this could be useful. Look for it in the next release, 1.1.4.0. And it's live right now. - JsnX

-----

----
===Fix for case sensitive/insensitive locales===
I modified the code so it doesn't break on case sensitive database locales. In cases where there really is a circular reference, this code does two DB queries more than the original to find out the correct case of the included page. Since this shouldn't really happen in the normal case, I don't think that it's an issue.
%%(php)
<?php
if (!$page) $page = $wikka_vars;
if (!$this->config["includes"]) $this->config["includes"][] = $this->tag;

if ($this->HasAccess("read", $page)) {
$page = $this->LoadPage($page);
if (!in_array($page["tag"], $this->config["includes"]) && $page["tag"] != $this->tag) {
$this->config["includes"][] = $page["tag"];
print $this->Format($page["body"]);
} else print "<span class='error'>Circular reference detected</span>";
}
?>
%%
--CyneBeald
Deletions:
=====Include other pages=====
The following action includes another wikipage and takes care not to be trapped in a circular reference, i.e. included pages can include other pages without running into trouble.

<<actions/include.php<<::c::

%%(php)
<?php
if (!$page) $page = $wikka_vars;
$page = strtolower($page);
if (!$this->config["includes"]) $this->config["includes"][] = strtolower($this->tag);

if (!in_array($page, $this->config["includes"]) && $page != $this->tag) {
if ($this->HasAccess("read", $page)) {
$this->config["includes"][] = $page;
$page = $this->LoadPage($page);

print $this->Format($page["body"]);
}
} else print "<span class='error'>Circular reference detected</span>";
?>
%%

-----

Thanks, Sebastian. Seems this could be useful. Look for it in the next release, 1.1.4.0. And it's live right now. - JsnX

-----



Revision [4944]

Edited on 2005-01-22 13:44:46 by ChristianBarthelemy [Added ::c:: after floating box]
Additions:
<<actions/include.php<<::c::
Deletions:
<<actions/include.php<<


Revision [4939]

Edited on 2005-01-22 07:06:24 by JavaWoman [Added ::c:: after floating box]
Additions:
To use: ""{{include page="PageName"}}"" or ""{{include PageName}}""
Deletions:
To use: ""{{include page="PaneName"}}"" or ""{{include PageName}}""


Revision [4938]

Edited on 2005-01-22 07:05:34 by JavaWoman [completed use code ;-) (but it will soon be elsewhere)]
Additions:
To use: ""{{include page="PaneName"}}"" or ""{{include PageName}}""
Deletions:
To use: ""{{include PageName}}""


Revision [4936]

Edited on 2005-01-22 05:56:12 by MovieLady [added use code]
Additions:
Thanks, Sebastian. Seems this could be useful. Look for it in the next release, 1.1.4.0. And it's live right now. - JsnX
To use: ""{{include PageName}}""
Deletions:
Thanks, Sebastian. Seems this could be useful. Look for it in the next release, 1.1.4.0. And it's live right now. - JsnX


Revision [1990]

Edited on 2004-10-25 18:50:26 by NilsLindenberg [typo]
Additions:
=====Include other pages=====
Deletions:
=====Includ other pages=====


Revision [1989]

Edited on 2004-10-25 18:41:44 by NilsLindenberg [header]
Additions:
=====Includ other pages=====
The following action includes another wikipage and takes care not to be trapped in a circular reference, i.e. included pages can include other pages without running into trouble.
<<actions/include.php<<
%%(php)
<?php
?>
%%
Deletions:
the following action includes another wikipage and takes care not to be trapped in a circular reference, i.e. included pages can include other pages without running into trouble.
**actions/include.php**
%%(php)<?php
?>%%


Revision [998]

Edited on 2004-08-15 05:22:12 by JsnX [short comments]
Additions:
if (!$page) $page = $wikka_vars;
?>%%
-----
Thanks, Sebastian. Seems this could be useful. Look for it in the next release, 1.1.4.0. And it's live right now. - JsnX
Deletions:
if (!$page) $page = $mind_vars;
?>%%


Revision [994]

The oldest known version of this page was created on 2004-08-14 23:36:51 by DreckFehler [short comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki