• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC


Forum rules


Only administrators can post or move items here.



Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: [open] start_level does not work
PostPosted: Sun Jul 05, 2015 4:07 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
a solution could be that
\$1:
   else if( $start_level > 1 ) {
        $tmp = $hm->sureGetNodeById($gCms->get_content_id());

        $arr = array();
        $arr2 = array();
        while( $tmp ) {
            $id = $tmp->get_tag('id');

            if( !$id ) break;
            $arr[$id] = $tmp;
            $arr2[] = $id;
            $tmp = $tmp->get_parent();
        }

        if( $start_level - 2 < count($arr) ) {
//$number is the place of the good $id in array $arr2
$number=count($arr)-($start_level-1);
            $id = $arr2[$number];

            $tmp = $arr[$id];

            if( $tmp->has_children() ) {
                $children = $tmp->get_children();
                foreach( $children as $one ) {
                    $rootnodes[] = $one;
                }
            }
        }
    }


Last edited by archeo on Sun Jul 05, 2015 9:55 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Sun Jul 05, 2015 5:22 pm 
Offline
Power Poster
Power Poster

Joined: Mon May 29, 2006 1:20 pm
Posts: 1946
Location: Rouen
SVN Navigato/action.default.php @ 10076
I have on a web page
- Notice: Undefined offset: 2 in \modules\Navigator\action.default.php on line 226
- Notice: Undefined index: in \modules\Navigator\action.default.php on line 227

_________________
Jean-Claude Etiemble


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Sun Jul 05, 2015 5:49 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
What is the contain of this lines?


Last edited by archeo on Sun Jul 05, 2015 6:30 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Sun Jul 05, 2015 5:53 pm 
Offline
Power Poster
Power Poster

Joined: Mon May 29, 2006 1:20 pm
Posts: 1946
Location: Rouen
@ archeo test the last rev 10079

_________________
Jean-Claude Etiemble


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Sun Jul 05, 2015 7:37 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
No warning message but no left menu with template "Top simple navigation + left subnavigation + 1 column" with level=1 but left menu with level >1.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Sun Jul 05, 2015 9:40 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
I think we must reconsider the problem.
consider a menu with six level and a start_level=6. At level 6 the id in $arr2 array are for exemple :
id=36,id=35,id=34,id=33,id=14i,d=11
the id to select is the second id=35.
What append when we are on level 3?
The id in $arr2 array are
id=33, id=14, id=11
The id to select is always id=35 but at this level we have not the information.
So for all the levels of the menu we should calculate $arr2 array for the most deep child.
after compare start_level and count($arr)
if start_level < count($arr) : invert arr2, select id in position start_level-1 and construct the menu using $tmp
else do nothing.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Mon Jul 06, 2015 6:56 am 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
After a good night's sleep, I think what I wrote above is not good with branching menus. So this code
SOLUTION 1
\$1:
   else if( $start_level > 1 ) {
        $tmp = $hm->sureGetNodeById($gCms->get_content_id());
        $arr = array();
        $arr2 = array();
        while( $tmp ) {
            $id = $tmp->get_tag('id');
            if( !$id ) break;
            $arr[$id] = $tmp;
            $arr2[] = $id;
            $tmp = $tmp->get_parent();
        }
       if( $start_level - 2 < count($arr) ) {
$number=count($arr)-($start_level-1);
            $id = $arr2[$number];
            $tmp = $arr[$id];
            if( $tmp->has_children() ) {
                $children = $tmp->get_children();
                foreach( $children as $one ) {
                    $rootnodes[] = $one;
                }
            }
        }
    }

or this other
SOLUTION 2
\$1:
   else if( $start_level > 1 ) {
        $tmp = $hm->sureGetNodeById($gCms->get_content_id());
        if( $tmp ) {
            $arr = array();
            $arr2 = array();
            while( $tmp ) {
                $id = $tmp->get_tag('id');
                if( !$id ) break;
                $arr[$id] = $tmp;
                $arr2[] = $id;
                $tmp = $tmp->get_parent();
            }
            if( $start_level <= count($arr2) or  count($arr2)==1) {
                $arr2 = array_reverse($arr2);
                $id = $arr2[$start_level-2];
                $tmp = $arr[$id];
                if( $tmp->has_children() ) {
                    // do childrenof this element
                    $children = $tmp->get_children();
                    foreach( $children as $one ) {
                        $rootnodes[] = $one;
                    }
                }
            }
        }
    }

Does the same job and mimics start_level in V1


Last edited by archeo on Wed Jul 08, 2015 10:14 am, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Tue Jul 07, 2015 1:21 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
Not fixed in the snapshop of this night.
"Top simple navigation + left subnavigation + 1 column" template text needs also to be update replacing all item "menu" by "Navigator"
and this "stupid start_level param" :) will be fixed


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Thu Jul 09, 2015 8:15 am 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
I think this is the good solution :

\$1:
else if( $start_level > 1 ) {
        $tmp = $hm->sureGetNodeById($gCms->get_content_id());
        if( $tmp ) {
            $arr = array();
            $arr2 = array();
            while( $tmp ) {
                $id = $tmp->get_tag('id');
                if( !$id ) break;
                $arr[$id] = $tmp;
                $arr2[] = $id;
                $tmp = $tmp->get_parent();
            }
            if( ($start_level-2) < count($arr2)) {
                $arr2 = array_reverse($arr2);
                $id = $arr2[$start_level-2];
                $tmp = $arr[$id];
                if( $tmp->has_children() ) {
                    // do childrenof this element
                    $children = $tmp->get_children();
                    foreach( $children as $one ) {
                        $rootnodes[] = $one;
                    }
                }
         }
        }
    }


test : start_level from 0 to 7 on menu level from 1 to 6 with branching menu
You can test with this data base http://ciavatti.free.fr/cmsv2/cmsrc1.sql(2).zip and I perform tests on my web site (menus with start_level 1,2 and 3 on the same page.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Thu Jul 09, 2015 6:13 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12670
Location: Arizona
If start_level will work with anything above 1 then it works as it should, imho, as there is no need to use start_level='1' that I can see and I've made hundreds of menus in the last 9+ years I've been using CMSMS...

The Menu manager and Navigator auto start on level 1, No..?

_________________
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
$1


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Thu Jul 09, 2015 6:19 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8164
Location: Fernie British Columbia, Canada
To my knowledge, The start_level parameter in Navigator currently works as it does in the MenuManager module. start_level must be >= 2.

There is no need to extend the functionality on this obscure, and difficult to understand option. And there is really no further need to spend time on it (it has already consumed too much time).

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Tue Jul 14, 2015 12:53 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7698
Location: The Netherlands
Is fixed in current snapshot.

_________________
$1

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return!



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [open] start_level does not work
PostPosted: Wed Aug 05, 2015 5:06 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 21, 2014 12:47 pm
Posts: 103
Location: Lorient (France)
calguy1000 \calguy1000:
There is no need to extend the functionality on this obscure, and difficult to understand option. And there is really no further need to spend time on it (it has already consumed too much time).

Perhaps, but it is a very powerfull parameter usefull on websites with a lot of pages. Thank you for your patience and for the time you consumed on.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting