Revision [3260]
This is an old revision of IncludePageAction made by JavaWoman on 2004-12-15 20:22:01.
IncludePageAction
This is a little action I made for including a page in another page, for example, a navigation bar. This is very useful if you want the same thing to appear on many different pages, but you don't want to have to edit each page every time you want to change something.
Syntax:
{{incpage page="PageName"}}
Save the following script as actions/incpage.php
-- Jamie
Hi Jamie. Thank you for the contribution, however it appears that your action duplicates an action that is already in Wikka version 1.1.4.0 and above. You can see the code for the standard Wikka 'include' action on the IncludeAction page. To avoid confusion, my preference is to remove this page. -- JsnX
<?php
if (!isset($vars['page'])) {
echo "No page specified.<br><br><strong>Syntax: {{incpage page=\"wikiname\"}}</strong> (Case insensitive)";
}
else {
$url = $vars['page'];
$host = $this->config['mysql_host'];
$db = $this->config['mysql_database'];
$user = $this->config['mysql_user'];
$passwd = $this->config['mysql_password'];
$connection = @mysql_connect($host, $user, $passwd);
@mysql_select_db($db, $connection);
$sql = "select body from" . $this->config['table_prefix'] . " pages where tag=\"$url\" and latest=\"Y\"";
$query = mysql_query($sql, $connection);
while ($nav = mysql_fetch_array($query)) {
$body = $nav['body'];
break;
}
$body = $this->Format($body, "wakka");
echo $body;
}
?>
if (!isset($vars['page'])) {
echo "No page specified.<br><br><strong>Syntax: {{incpage page=\"wikiname\"}}</strong> (Case insensitive)";
}
else {
$url = $vars['page'];
$host = $this->config['mysql_host'];
$db = $this->config['mysql_database'];
$user = $this->config['mysql_user'];
$passwd = $this->config['mysql_password'];
$connection = @mysql_connect($host, $user, $passwd);
@mysql_select_db($db, $connection);
$sql = "select body from" . $this->config['table_prefix'] . " pages where tag=\"$url\" and latest=\"Y\"";
$query = mysql_query($sql, $connection);
while ($nav = mysql_fetch_array($query)) {
$body = $nav['body'];
break;
}
$body = $this->Format($body, "wakka");
echo $body;
}
?>
CategoryDevelopment