Loading...
 
Skip to main content

Ability to use a structure as a menu {menu structureId=1}

Status
Closed
Subject
Ability to use a structure as a menu {menu structureId=1}
Version
1.9.x
Category
  • Feature request
Feature
Menu
Templates (Smarty)
Modules
Site Identity
Wiki Structure (book & table of content)
Search engine optimization (SEO)
Resolution status
Fixed or Solved
Submitted by
homunq
Volunteered to solve
homunq
Lastmod by
Marc Laporte
Rating
(0)
Description
I can't see the reason for the separation between the structures feature and the menu feature - structures are massively easier to create and edit, but only menus can be shown collapsibly. Separation of functions leads to confusion and harder support.
Solution
  • Add options to the wikistructure smarty function to allow it to create phplm - type menus.

  • collapse the three used structure_toc... smarty templates (-leaf.tpl, -startul.tpl, and -endul.tpl) back into one ..._level.tpl (also filed as separate bug)

  • Allow the current page and its ancestors to have additional style applied through css in the menu (NON-WORKING code snippet below gives an idea of how)


start code snippet: (the idea is that build_subtree_toc keeps a path as well as a tree, the smarty can use a counter to keep track of depth as it recursively calls itself and thus check the current page against the path at the correct depth)


function build_subtree_toc($id,$currentPageId,$slide=false,$order='asc',$tocPrefix='',$depth=0) {
$cant = $this->getOne("select count(*) from `tiki_structures` where `parent_id`=?",arrayint)$id;
if ($cant) {
if ($id == $currentPageId) {
$path = array($id);
} else {
$path = false;
}
$query = "select `page_ref_id`, `pageName`, `page_alias`, tp.`description` from `tiki_structures` ts, `tiki_pages` tp ";
$query.= "where ts.`page_id`=tp.`page_id` and `parent_id`=? order by ".$this->convert_sortmode("pos_".$order);
$result = $this->query($query,arrayint)$id;
$prefix=1;
while ($res = $result->fetchRow()) {
$res'prefix'=($tocPrefix==)?:"$tocPrefix.";
$res'prefix'.=$prefix;
$prefix++;
if ($res'page_ref_id' != $id) {
$sub = $this->build_subtree_toc($res'page_ref_id',$slide,$order,$res'prefix',$currentPageId);
if (is_array($sub'tree')) {
$res'sub' = $sub'tree';
if ($sub'path') {
$path = array_merge($id,$sub('path'));
}
}
}
if ($res%22page_alias%22<>"") $res%22pageName%22=$res%22page_alias%22;
$back[] = $res;
}
} else {
return array('tree'=>false, 'path'=>false);
}
return array('tree'=>$back,'path'=>$path);
}

function get_toc($page_ref_id,$currentPageId,$order='asc',$showdesc=false,$numbering=true,$numberPrefix='',$type='plain',$maxdepth=0) {
$structure_tree_holder = $this->build_subtree_toc($page_ref_id,$currentPageId,false,$order,$numberPrefix);
$smarty->assign('struct_type',$type);
$smarty->assign('struct_tree',$structure_tree_holder'tree');
$smarty->assign('path_to_current',$structure_tree_holder'path');
$smarty->assign('struct_showdesc',$showdesc);
$smarty->assign('struct_numbering',$numbering);
$smarty->assign('struct_prefix',$numberPrefix);
$smarty->assign('struct_curdepth',0);
return $smarty->fetch("structures_toc-level.tpl");
//return $this->fetch_toc($structure_tree,$showdesc,$numbering,$type,$asmenu,$detailstyle,$maxdepth);
}

Importance
8
Priority
40
Demonstrate Bug on Tiki 19+
Please demonstrate your bug on show2.tiki.org
Demonstrate Bug (older Tiki versions)
Ticket ID
1045
Created
Thursday 05 April, 2007 00:52:26 UTC
by Unknown
LastModif
Thursday 14 January, 2010 18:59:48 UTC


Collapse/expand modules below
Show PHP error messages