Sub-Pages Action

See Also
  • Tree - Also show some hierarchical structure.
NOT Included in any Wikka version yet
Last edited by NickAldwin:
Replaces old-style internal links with new pipe-split links.
Fri, 20 May 2016 07:38 UTC [diff]

What

Use

Features

Parameters
nametyperequired?defaultdescription
pagestringoptionalcurrent pageThe page that will be used to show the subpages from.


Installation

Code
<?php
// Shows pagenames that have the current pagename as start.
// by OnegWR, may 2005, license GPL
// modified by NickAldwin, April 2010

if( is_array($vars) AND isset($vars['page']) AND $this->ExistsPage($vars['page']) ){
    $sp_tag = $vars['page'];
}else{
    $sp_tag = $this->GetPageTag();
}
$sp_len = strlen($sp_tag);
$sp_links = array();
$sp_str = "SELECT `tag` FROM `".$this->config["table_prefix"]."pages` ".
    "WHERE `tag` LIKE '".$sp_tag."%' ".
    "AND `latest` = 'Y' ORDER BY `tag` ASC";

if ($sp_pages = $this->LoadAll( $sp_str )){
    foreach($sp_pages as $sp_page){
            if ($sp_tag == $sp_page['tag']) continue;
            //$sp_links[]=$this->Link($sp_page['tag']); // Show full name
            $sp_links[]=$this->Link($sp_page['tag'],'',substr($sp_page['tag'],$sp_len));
    }
    if( count( $sp_links ) > 0 ){
            print "\t\t<ul class=\"subpages\">\n\t<li>";
            print implode("</li>\n\t<li>", $sp_links);
            print "</li>\n</ul>\n\n";
    }
}
?>

History



CategoryUserContributions
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki