The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Child menu plugin
#76
Well, that's nice and all, but I want ALWAYS display only (and only) submenu (child) items after clicking on „closed“ top menu item – not to add new <ul> to existing menu, but always completely replace whole navigation with child items.

consider this:
<ul id="nav">
<li>item1</li>
<li class="closed">item 2</li> (this contains subpages)
</ul>

After clicking on "closed" item 2 I would like to achieve this:
<ul id="nav">
<li>item 2</li> (previously clicked top page with link working like „back“ button – returning back to top, original menu)
<li>subpage 1</li>
<li>subpage 2</li>
<li class="closed">subpage 3</li> (again, containg subpages)
</ul>

Is this possible? Currently, what I get is only appending new <ul> element to Menu element containg subpages. ie:
<li class="open">item 2
<ul>
<li>subpage 1</li>
<li>subpage 2</li>
</ul>
</li>
Reply
#77
Hello,

Thanks for this plugin.

I have a problem. When a call the function <?php go_child_menu(); ?>
the name of the child menu is always the same, for exemplo :

I have the sub menu call child-01, child-01, child-03, child-04 (4 child menus).

but they show : child-01, child-01, child-01, child-01. (but the URL is alright).

Can anybody help me.

André Lima
Reply
#78
added some changes to code
[/php]

added ability to omit parent and use custom tags (ul/li instead of div/p) using in-php settings, I've also added default blank values for childmenu and chilpmenuparent, because I kept getting an error when it was creating the cache.
Code:
    $includeParent = false;
    $tagLineItem = "li";
    $tagLineholder = "ul";
    $childmenu= '';
    $childmenuparent= '';

PHP Code:
<?php
/*
Plugin Name: Child Menu
Description: Prints parent title, children and siblings titles as a cached menu on parent and child pages.
Version: 1.8
Author: Erik
Author URI: http://www.fohlin.net/getsimple-child-menu-plugin
*/

// get correct id for plugin
$thisfile basename(__FILE__'.php'); // This gets the correct ID for the plugin.

// register plugin
register_plugin(
    
$thisfile,    // ID of plugin, should be filename minus php
    
'Child Menu',    # Title of plugin
    
'1.8',    // Version of plugin
    
'Erik',    // Author of plugin
    
'http://www.fohlin.net/getsimple-child-menu-plugin',    // Author URL
    
'Prints parent title, children and siblings titles as a cached menu on parent and child pages.',    // Plugin Description
    
'template',    // Page type of plugin
    
'go_child_menu'    // Function that displays content
);

// activate actions
//add_action('content-top','go_child_menu'); //Can be used if you need an action.
add_action('changedata-save','clear_child_menu_cache'); 

// functions
function clear_child_menu_cache() 
{
    
$cachepath GSDATAOTHERPATH.'child_menu_cache/';
    if (
is_dir($cachepath))
    {
        
$dir_handle = @opendir($cachepath) or exit('Unable to open ...getsimple/data/other/child_menu_cache folder');
        
$filenames = array();
        
        while (
$filename readdir($dir_handle))
        {
            
$filenames[] = $filename;
        }
        
        if (
count($filenames) != 0)
        {
            foreach (
$filenames as $file
            {
                if (!(
$file == '.' || $file == '..' || is_dir($cachepath.$file) || $file == '.htaccess'))
                {
                    
unlink($cachepath.$file) or exit('Unable to clean up ...getsimple/data/other/child_menu_cache folder');
                }
            }
        }
    }
}


function 
go_child_menu() 
{
    
$includeParent false;
    
$tagLineItem "li";
    
$tagLineholder "ul";
    
$childmenu'';
    
$childmenuparent'';

    
$active_page=return_page_slug();
    
$cashepath GSDATAOTHERPATH.'child_menu_cache/'.$active_page.'.cache';
    
    if (
is_file($cashepath)) //We have a cashed file, use it.
    
{
        echo 
file_get_contents($cashepath);
    }
    else 
//We do not have a cached file, create a new one.
    
{
        global 
$PRETTYURLS;
        
$dir_handle = @opendir(GSDATAPAGESPATH) or exit('Unable to open ...getsimple/data/pages folder');
        
        
$active_parent=return_parent();
        if (
strlen($active_parent)==0)
        {
            
$active_parent=return_page_slug();
        }
    
        
$filenames = array();
        
        while (
$filename readdir($dir_handle))
        {
            
$filenames[] = $filename;
        }
        
        if (
count($filenames) != 0)
        {
            
sort($filenames); //Sort according to page Slug/URL
            
$childmenuarray = array();
            
$childmenusortarray = array();
            
$slugsortorder 21;
            
            
//Loop through all pages
            
foreach ($filenames as $file
            {
                if (!(
$file == '.' || $file == '..' || is_dir(GSDATAPAGESPATH.$file) || $file == '.htaccess'))
                {
                    
$thisfile file_get_contents(GSDATAPAGESPATH.$file);
                    
$XMLdata simplexml_load_string($thisfile);
                    
                    
//If parent.
                    
if ($XMLdata->private != 'Y' and strcmp($XMLdata->url,$active_parent)==and $includeParent == true)
                    {
                        
//Check if current page
                        
if (strcmp($XMLdata->url,$active_page)==0)
                        {
                            
$current=' class="current"';
                        }
                        else
                        {
                            
$current='';
                        }
                        
                        
//Store the parent page data
                        
if ($PRETTYURLS==1)
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
$childmenuparent='<p id="parent"'.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></p>';
                            }
                            else
                            {
                                
$childmenuparent='<p id="parent"'.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></p>';
                            }
                        }
                        else
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
$childmenuparent='<p id="parent"'.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></p>';
                            }
                            else
                            {
                                
$childmenuparent='<p id="parent"'.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></p>';
                            }
                        }
                    }
                    elseif (
$XMLdata->private != 'Y' and strcmp($XMLdata->parent,$active_parent)==0//If child.
                    
{
                        
//Build the menu order sorting array
                        
if ($XMLdata->menuOrder>0)
                        {
                            
$childmenusortarray[]=$XMLdata->menuOrder;
                        }
                        else
                        {
                            
$childmenusortarray[]=$slugsortorder//Default to top
                        
}
                        
$slugsortorder++;
                        
                        
//Check if current page
                        
if (strcmp($XMLdata->url,$active_page)==0)
                        {
                            
$current=' class="current"';
                        }
                        else
                        {
                            
$current='';
                        }
                        
                        
//Build the child menu array
                        
if ($PRETTYURLS==1)
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
$childmenuarray[]='<'.$tagLineItem.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></'.$tagLineItem.'>';
                            }
                            else
                            {
                                
$childmenuarray[]='<'.$tagLineItem.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></'.$tagLineItem.'>';
                            }
                        }
                        else
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
$childmenuarray[]='<'.$tagLineItem.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></'.$tagLineItem.'>';
                            }
                            else
                            {
                                
$childmenuarray[]='<'.$tagLineItem.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></'.$tagLineItem.'>';
                            }
                        }
                    }
                }
            }
            
            
//Sort the child menu numerically according to menu order
            
array_multisort($childmenusortarray,SORT_ASC,SORT_NUMERIC,$childmenuarray);
            foreach (
$childmenuarray as $childmenuitem
            {
                
$childmenu=$childmenu.$childmenuitem;
            }
            
            if (
strlen($childmenu)>0)
            {
                
$thismenu='<'.$tagLineholder.' id="child_menu">'.$childmenuparent.$childmenu.'</'.$tagLineholder.'>';
                echo 
'<!-- un-cached -->'.$thismenu;
            }
            else
            {
                
$thismenu=''//$thismenu='<div id="child_menu"></div>'; //If you want the child menu div even if there is no child menu.
            
}
            
            
//Check if cache folder exists.
            
if (is_dir(GSDATAOTHERPATH.'child_menu_cache')==false)
            {
                
mkdir(GSDATAOTHERPATH.'child_menu_cache'0755) or exit('Unable to create ...getsimple/data/other/child_menu_cache folder');
            }
            
            
//Save cached child menu file.
            
$fp = @fopen($cashepath'w') or exit('Unable to save ...getsimple/data/other/child_menu_cache/'.$active_page);
            
fwrite($fp$thismenu);
            
fclose($fp);
        }
    }
}

?>
Reply
#79
Hello guys,
this plugin simplicity is awesome. However, I came to a little problem which I don't know how to solve.

I have a horizontal tab menu and a the most tabs have their vertical submenus created with this great plugin. My CSS uses current tab highlighting and that's where the problem comes.
The problem is that I after I click onto some of the submenu tabs, the current tab in the horizontal menu is not current anymore and become unhighlighted.

This web http://www.brusirnaskla.cz/lustrove-ovesy/vachtle/ has it the way I want it too, but I think it uses I18N plugin (it's multilingual).

Is there a way to keep both current menu tabs (one in horizontal menu and one in vertical submenu) highlighted in the same time with this plugin? Or do I have to use I18N? I hope not, I don't want more functions than I need. But I have have to change the plugin, I will.

Thanks for your help! Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#80
@TeeJay
Try this:
http://get-simple.info/forums/showthread.php?tid=2697&pid=20565#pid20565
Reply
#81
(2013-03-29, 20:38:35)Carlos Wrote: @TeeJay
Try this:
http://get-simple.info/forums/showthread.php?tid=2697&pid=20565#pid20565
It works! Thanks you. I really appreciate your help, I really do.
Sorry that I didn't find the solution which is already posted by myself, I was searching for different keywords. Thank you again. Shy
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#82
Even using the correct keywords, it's really hard finding anything on this site (both forum and Extend).

I always search with google using site:get-simple.info keywords
Reply
#83
(2013-03-29, 20:55:27)Carlos Wrote: Even using the correct keywords, it's really hard finding anything on this site (both forum and Extend).

I always search with google using site:get-simple.info keywords
Ok, next time Smile thank you for the information. Now I'm in a good mood thanks to your solution which made me progress, yupeee Big Grin
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#84
Question 
Hey! I love this plugin. Working good so far.

One issue I am having is I changed the name and slug of some pages. The slug changed and the links still work, but because it's cached the name displays wrong.

So I created new pages and deleted the old pages. But the deleted pages are still listed.

I opened the PHP file and say it say "getsimple/data/other/child_menu_cache folder'" so I went there and just deleted the files and now it works fine. Is there a way to do it without manually deleting the files? I see it said it adds the action 'clear_child_menu_cache' but I am not sure where to find this action.

I'd love to know. Thanks!
Reply
#85
(2013-07-13, 11:19:44)ShawnPConroy Wrote: Hey! I love this plugin. Working good so far.

One issue I am having is I changed the name and slug of some pages. The slug changed and the links still work, but because it's cached the name displays wrong.

So I created new pages and deleted the old pages. But the deleted pages are still listed.

I opened the PHP file and say it say "getsimple/data/other/child_menu_cache folder'" so I went there and just deleted the files and now it works fine. Is there a way to do it without manually deleting the files? I see it said it adds the action 'clear_child_menu_cache' but I am not sure where to find this action.

I'd love to know. Thanks!

hey friend, i'm getting the same problem as you. the plugin does not refresh the menu after i make some changes to title / slug. seems nobody answered yet!
Reply
#86
Hi everybody,
I'm new to this plugin and I'm quite stuck. It seems it doesnt display links to child pages but only siblings and the parent page. Is there a way I can get it to display child pages instead?
Thanks
Reply
#87
(2013-11-12, 13:22:49)mdique Wrote: ..it doesnt display links to child pages but only siblings and the parent page. ...

That plugin only supports one additional level of menu, so if you are seeing a group of siblings and their parent in a sub-menu it is working as intended.
Reply
#88
hello ...

i have some Code-Tweaks
include this
search for:
PHP Code:
if ($PRETTYURLS==1)
{
  if (
strlen($XMLdata->menu)>0)
    {
        
$childmenuparent='<p id="parent"'.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></p>';
    }
    else
    {
        
$childmenuparent='<p id="parent"'.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></p>';
    }
}
else
{
    if (
strlen($XMLdata->menu)>0)
    {
        
$childmenuparent='<p id="parent"'.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></p>';
    }
    else
    {
        
$childmenuparent='<p id="parent"'.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></p>';
    }

replace with:
PHP Code:
$view_string = ( (strlen($XMLdata->menu) > 0) ? $XMLdata->menu $XMLdata->title );
$pre_url     = ( ($PRETTYURLS == 1)           ? ''             'index.php?id=' );

$childmenuparent '<p id="parent"' $current '><a href="' $pre_url $XMLdata->url '">' .
                               
stripslashes(htmlspecialchars_decode($view_string)) . '</a></p>'
and
search for:
PHP Code:
if ($PRETTYURLS==1)
{
    if (
strlen($XMLdata->menu)>0)
    {
        
$childmenuarray[]='<p'.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></p>';
    }
    else
    {
        
$childmenuarray[]='<p'.$current.'><a href="'.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></p>';
    }
}
else
{
    if (
strlen($XMLdata->menu)>0)
    {
        
$childmenuarray[]='<p'.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></p>';
    }
    else
    {
        
$childmenuarray[]='<p'.$current.'><a href="index.php?id='.$XMLdata->url.'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></p>';
    }

replace with:
PHP Code:
$view_string = ( (strlen($XMLdata->menu) > 0) ? $XMLdata->menu $XMLdata->title );
$pre_url     = ( ($PRETTYURLS == 1)           ? ''             'index.php?id=' );

$childmenuarray[] = '<' $tagLineItem $current '><a href="' $pre_url $XMLdata->url '">' .
                    
stripslashes(htmlspecialchars_decode($view_string)) . '</a></' $tagLineItem '>'
and
search for:
PHP Code:
$childmenu '';
foreach (
$childmenuarray as $childmenuitem)
{
    
$childmenu=$childmenu.$childmenuitem;

repalce with:
PHP Code:
$childmenu implode("\n  "$childmenuarray); 
Reply
#89
(2013-09-12, 01:04:36)dedos Wrote:
(2013-07-13, 11:19:44)ShawnPConroy Wrote: Hey! I love this plugin. Working good so far.

One issue I am having is I changed the name and slug of some pages. The slug changed and the links still work, but because it's cached the name displays wrong.

So I created new pages and deleted the old pages. But the deleted pages are still listed.

I opened the PHP file and say it say "getsimple/data/other/child_menu_cache folder'" so I went there and just deleted the files and now it works fine. Is there a way to do it without manually deleting the files? I see it said it adds the action 'clear_child_menu_cache' but I am not sure where to find this action.

I'd love to know. Thanks!

hey friend, i'm getting the same problem as you. the plugin does not refresh the menu after i make some changes to title / slug. seems nobody answered yet!

I also got this problem ... 
Only way (for me) is the delete the cached files by hand. The "flush all caches" function under main settings didn't work for the child menu :/

PS: also after deleting the cached files, the plugin creates new empty files from last subpages EVEN they're still deleted and not present as a page.
Reply
#90
DO NOT USE! This plugin is broken.

It has not been updated since "October 11, 2011". I don´t know why this is still listed on get-simple site. But don´t use it. It works great until you try to change the subject. It will never change. See above! Do not use!
Reply
#91
(2016-12-09, 07:40:39)djman9 Wrote: DO NOT USE! This plugin is broken.

It has not been updated since "October 11, 2011". I don´t know why this is still listed on get-simple site. But don´t use it. It works great until you try to change the subject. It will never change. See above! Do not use!
All of them will be listed, because there is no point in terms of service saying "Plugin author must update his work regularly".
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
#92
(2016-12-09, 07:40:39)djman9 Wrote: DO NOT USE! This plugin is broken.

It has not been updated since "October 11, 2011". I don´t know why this is still listed on get-simple site. But don´t use it. It works great until you try to change the subject. It will never change. See above! Do not use!

It works, but shows the menu text instead of the page title. The menu text field is not visible/editable unless you enable "Add this page to the menu" (and after editing the field you should disable it so that it's not shown in the main page navigation).

Anyway the plugin is outdated. It uses the old GS default fancy urls structure (without trailing slash), it doesn't support custom permalink structures...

Some alternatives are the I18N plugin, or if you don't need multilanguage support and don't want the page management to be changed, the Hierarchical Menus plugin.
Reply
#93
I still really like this plugin for its simplicity.  I didn't really want to mess with setting up some of the more extensive plugins when all I wanted were some nested side menus.  Posting my edited code below.  It makes the menu into a nested unordered list and fixes some of the problems with displaying titles and using the right nested URLs for pages.  See previous comments on this thread for other great ideas.

I also use the trick mentioned above of using Page Options "add to menu" to set a custom menu string/priority and then disable it afterward so it isn't on the main menu.

Anything I changed flagged with "EDIT [RAG]", or you can diff with version 1.8.

PHP Code:
<?php
/*
Plugin Name: Child Menu
Description: Prints parent title, children and siblings titles as a cached menu on parent and child pages.
Version: 1.8
Author: Erik
Author URI: http://www.fohlin.net/getsimple-child-menu-plugin
*/

// get correct id for plugin
$thisfile basename(__FILE__'.php'); // This gets the correct ID for the plugin.

// register plugin
register_plugin(
    
$thisfile,    // ID of plugin, should be filename minus php
    
'Child Menu',    # Title of plugin
    
'1.8',    // Version of plugin
    
'Erik',    // Author of plugin
    
'http://www.fohlin.net/getsimple-child-menu-plugin',    // Author URL
    
'Prints parent title, children and siblings titles as a cached menu on parent and child pages.',    // Plugin Description
    
'template',    // Page type of plugin
    
'go_child_menu'    // Function that displays content
);

// activate actions
//add_action('content-top','go_child_menu'); //Can be used if you need an action.
add_action('changedata-save','clear_child_menu_cache'); 

// functions
function clear_child_menu_cache() 
{
    
$cachepath GSDATAOTHERPATH.'child_menu_cache/';
    if (
is_dir($cachepath))
    {
        
$dir_handle = @opendir($cachepath) or exit('Unable to open ...getsimple/data/other/child_menu_cache folder');
        
$filenames = array();
        
        while (
$filename readdir($dir_handle))
        {
            
$filenames[] = $filename;
        }
        
        if (
count($filenames) != 0)
        {
            foreach (
$filenames as $file
            {
                if (!(
$file == '.' || $file == '..' || is_dir($cachepath.$file) || $file == '.htaccess'))
                {
                    
unlink($cachepath.$file) or exit('Unable to clean up ...getsimple/data/other/child_menu_cache folder');
                }
            }
        }
    }
}


function 
go_child_menu() 
{
    
$active_page=return_page_slug();
    
$cashepath GSDATAOTHERPATH.'child_menu_cache/'.$active_page.'.cache';
    
    if (
is_file($cashepath)) //We have a cashed file, use it.
    
{
        echo 
file_get_contents($cashepath);
    }
    else 
//We do not have a cached file, create a new one.
    
{
        global 
$PRETTYURLS;
        
$dir_handle = @opendir(GSDATAPAGESPATH) or exit('Unable to open ...getsimple/data/pages folder');
        
        
$active_parent=return_parent();
        if (
strlen($active_parent)==0)
        {
            
$active_parent=return_page_slug();
        }
    
        
$filenames = array();
        
        while (
$filename readdir($dir_handle))
        {
            
$filenames[] = $filename;
        }
        
        if (
count($filenames) != 0)
        {
            
sort($filenames); //Sort according to page Slug/URL
            
$childmenuarray = array();
            
$childmenusortarray = array();
            
$slugsortorder 21;
            
            
//Loop through all pages
            
foreach ($filenames as $file
            {
                if (!(
$file == '.' || $file == '..' || is_dir(GSDATAPAGESPATH.$file) || $file == '.htaccess'))
                {
                    
$thisfile file_get_contents(GSDATAPAGESPATH.$file);
                    
$XMLdata simplexml_load_string($thisfile);
                    
                    
//If parent.
                    
if ($XMLdata->private != 'Y' and strcmp($XMLdata->url,$active_parent)==0)
                    {
                        
//Check if current page
                        
if (strcmp($XMLdata->url,$active_page)==0)
                        {
                            
$current=' class="current"';
                        }
                        else
                        {
                            
$current='';
                        }
                        
                        
//Store the parent page data
                        
if ($PRETTYURLS==1)
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
// EDIT [RAG] Change to list item, add link title, fix nested URLs
                                
$childmenuparent='<li id="parent"'.$current.'><a href="'.find_url($XMLdata->url'').'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></li>';
                            }
                            else
                            {
                                
// EDIT [RAG] Change to list item, add link title, fix nested urls
                                
$childmenuparent='<li id="parent"'.$current.'><a href="'.find_url($XMLdata->url'').'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></li>';
                            }
                        }
                        else
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
// EDIT [RAG] Change to list item, add link title
                                
$childmenuparent='<li id="parent"'.$current.'><a href="index.php?id='.$XMLdata->url.'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></li>';
                            }
                            else
                            {
                                
// EDIT [RAG] Change to list item, add link title
                                
$childmenuparent='<li id="parent"'.$current.'><a href="index.php?id='.$XMLdata->url.'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></li>';
                            }
                        }
                    }
                    elseif (
$XMLdata->private != 'Y' and strcmp($XMLdata->parent,$active_parent)==0//If child.
                    
{
                        
//Build the menu order sorting array
                        
if ($XMLdata->menuOrder>0)
                        {
                            
$childmenusortarray[]=$XMLdata->menuOrder;
                        }
                        else
                        {
                            
$childmenusortarray[]=$slugsortorder//Default to top
                        
}
                        
$slugsortorder++;
                        
                        
//Check if current page
                        
if (strcmp($XMLdata->url,$active_page)==0)
                        {
                            
$current=' class="current"';
                        }
                        else
                        {
                            
$current='';
                        }
                        
                        
//Build the child menu array
                        
if ($PRETTYURLS==1)
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
// EDIT [RAG] Change to list item, add link title, fix nested links
                                
$childmenuarray[]='<li'.$current.'><a href="'.find_url($XMLdata->url$active_parent).'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></li>';
                            }
                            else
                            { 
                           
                                
// EDIT [RAG] Change to list item, add link title, fix nested links
                                
$childmenuarray[]='<li'.$current.'><a href="'.find_url($XMLdata->url$active_parent).'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></li>';
                            }
                        }
                        else
                        {
                            if (
strlen($XMLdata->menu)>0)
                            {
                                
// EDIT [RAG] Change to list item, add link title
                                
$childmenuarray[]='<li'.$current.'><a href="index.php?id='.$XMLdata->url.'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->menu)).'</a></li>';
                            }
                            else
                            {
                                
// EDIT [RAG] Change to list item, add link title
                                
$childmenuarray[]='<li'.$current.'><a href="index.php?id='.$XMLdata->url.'" title="'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'">'.stripslashes(htmlspecialchars_decode($XMLdata->title)).'</a></li>';
                            }
                        }
                    }
                }
            }
            
            
// EDIT [RAG] Added to avoid notice about undefined variable (2013.11.23)
            
if (!isset($childmenu))
            {
                
$childmenu "";
            }
            
            
//Sort the child menu numerically according to menu order
            
array_multisort($childmenusortarray,SORT_ASC,SORT_NUMERIC,$childmenuarray);
            foreach (
$childmenuarray as $childmenuitem
            {
                
$childmenu=$childmenu.$childmenuitem;
            }
            
            if (
strlen($childmenu)>0)
            {
                
// EDIT [RAG] Add nav element and unordered list
                
$thismenu='<nav id="child-menu" class="one-third column"><ul>'.$childmenuparent.$childmenu.'</ul></nav>';
                echo 
'<!-- un-cached -->'.$thismenu;
            }
            else
            {
                
// EDIT [RAG] Add empty nav element
                
$thismenu=''//$thismenu='<nav id="child-menu"></nav>'; //If you want the child menu div even if there is no child menu.
            
}
            
            
//Check if cache folder exists.
            
if (is_dir(GSDATAOTHERPATH.'child_menu_cache')==false)
            {
                
mkdir(GSDATAOTHERPATH.'child_menu_cache'0755) or exit('Unable to create ...getsimple/data/other/child_menu_cache folder');
            }
            
            
//Save cached child menu file.
            
$fp = @fopen($cashepath'w') or exit('Unable to save ...getsimple/data/other/child_menu_cache/'.$active_page);
            
fwrite($fp$thismenu);
            
fclose($fp);
        }
    }
}

?>
Reply
#94
Hi,

is it possible to have a small documentation how to use it, the original site page doesn't exist anymore ? 

I have tried it but my menus continue to appear on the main line and not in sub- although I have put <ul><?php go_child_menu(); ?></ul> in my code

EDIT: it seems that this plugin is not compatible with the last version of GS ! any update ???

tkx,
Domi.
Reply




Users browsing this thread: 6 Guest(s)