===== Sub-Pages Action ===== >>==See Also== ~- [[OnegWRTree | Tree]] - Also show some hierarchical structure. >>//NOT Included in any Wikka version yet//{{lastedit}} ==What== ~- Create a menu with links to sub-pages. ~- A page is considered a sub-page if the first x chars are the same as the current page. ~- Optional you can define an other page than the current by using the "page" parameter. ==Use== ~- Include on the page where you would like to include this menu this string: ~~""{{subpages}}"" or ~~""{{subpages page="HomePage"}}"" ==Features== ~- If there are no subpages found, nothing will be included. ~- The "page" parameter needs to be a existing page, otherwise the current page will be used. ~- The first x chars that are identical to the parent-page are removed. If you like to see the full name, uncomment the right code in the foreach-loop. ~- Layout (hor, vert, colors,...) can be done by giving the right option to the "ul.subpage" class in CSS. ==Parameters== ~""
nametyperequired?defaultdescription
pagestringoptionalcurrent pageThe page that will be used to show the subpages from.
"" ==Installation== ~- Save the code below as ##actions/subpages/subpages.php## ~- Give it the same file permissions as the php files in the actions directory. ~- Note: function ""ExistsPage"" is included in 1.1.6.0 ==Code== %%(php) 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\n\n"; } } ?> %% ==History== ~- Published on main site (2005-05-09) - OnegWR ~- Fixed counting bug & instructions (2011-04-11) - NickAldwin ---- CategoryUserContributions