Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If page is empty than it works like a trigger to open sublevel pages with content

i want to say big thank you for such a good cms!

I want to create a documentation page with a tree. Everything works fine, i am using i18n plugin to show a structure tree. The only problem is that even if i leave page empty and i click on it in a tree, it is loaded empty.

I want that left empty pages become as a separators which will expand sublevel pages with content

Like this:

Maybe someone can point me to the right direction?
So you want fake parents, that are not actual pages or linked to actual pages ?
You can probably get what you want using the custom module option of i18n nav if you know php.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Yes, you are right! I edited plugins/sitemap.php and found this:

function sm_get_link($page) {
$url = $page['url'];
$title = $page['title'];
return "<a href=\"$url\">$title</a>";

How to detect if page has no data in it, than this function return only page name without link, and if it is normal page with content, than it will be normal link.

Or there is another way to modify standard page structure tree?
I had a simmilar need, so I came up with this. It uses i18n plugin's navigation API functions.
PHP Code:
function custom_tree_nav$current_slug null$entries false )
$current_slug $current_slug $current_slug get_page_slugfalse );

    if( !
$entries )
$entries return_i18n_menu_data$current_slug099I18N_SHOW_MENU );

$entries as $entry )
# 'current' menu entry class tag.
$current $entry['current'] ? ' current' '';

# Get menu name, or page name if menu name empty.
$menu $entry['menu'] ? $entry['menu'] : $entry['title'];

# This may need to be adjusted according to installation specifics
$slug '/'.$entry['url'];

$url $entry['url'];

        if( !empty( 
$entry['children'] ) )
# Might want to throw an 'a' instead of 'span'.
echo '<li><span class="'.$url.$current.'">'.$menu.'</span>';
custom_tree_nav$current_slug$entry['children'] );
'<li><a class="'.$url.$current.'" href="'.$slug.'" target="_self">'.$menu.'</a></li>'."\n";

Put this function in your theme's functions.php file, then call it from your template file like this: <?php custom_tree_nav(); ?>

It will create the raw HTML menu code. Be aware that no checks are made whether a page is empty or not, rather a page is checked for existence of children. Also, no attempt was made to recreate the url structure, as GS will (with proper configuration) accept anything after the last slash as a page slug, and return the correct page.

Any CSS styling + JS behavior is up to you.
Thank you, but maybe you can explain how to integrate this modification? And how to call this tree in sidebar. Thank you!
.. I know that this is old thread, but I think it's really a good idea. all bigger CMS systems have possibility to add "divider" into menu, so there is no page related to it. I was thinking about adding checkbox in menu section of page preferences, where I can select if I want normal page or just divider. but the idea with empty page to be automatically divider is really good. I know that this can be done by custom module in i18n, but what about sitemap? I don't want empty pages to be in sitemap, just their names in path for their children pages .. so do I need to hack everything just because I want parents non-clickable and maybe also parent that holds megamenu (where parent is a title for it's children..) ?

Users browsing this thread: 1 Guest(s)