Revision [2428]
This is an old revision of IncludePageAction made by JamieScuffell on 2004-11-24 18:52:55.
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
php <?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; } ?>
CategoryDevelopment