How to access page_start variable in Navigator

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
MZTech
Forum Members
Forum Members
Posts: 16
Joined: Tue May 28, 2013 10:51 am

How to access page_start variable in Navigator

Post by MZTech »

How do I access the start_page variable set in {Navigator start_page="TEST"} inside Navigator::Navigation template?
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: How to access page_start variable in Navigator

Post by PinkElephant »

Hi MZTech

There's nothing doing in {$nodes|print_r} but {get_template_vars} shows a way:

Code: Select all

<h3>DEBUG: start_page={$actionparams['start_page']|default:'(not specified)'}</h3>
MZTech
Forum Members
Forum Members
Posts: 16
Joined: Tue May 28, 2013 10:51 am

Re: How to access page_start variable in Navigator

Post by MZTech »

Thank you very much. It worked.
Didn't know about {get_template_vars}.

How did you extract that DEBUG: start_page?

When I use {get_template_vars} I dont see start_page.
User avatar
PinkElephant
Forum Members
Forum Members
Posts: 169
Joined: Fri Feb 06, 2009 2:08 pm

Re: How to access page_start variable in Navigator

Post by PinkElephant »

With {get_template_vars} in the Nav template you should have seen something like:

Code: Select all

$actionparams (array) = [
   .template (string) = Example v02 - Nav submenu DEBUG
   .start_page (string) = test
   .childrenof (string) = testbed
   .show_all (integer) = 1
   .loadprops (integer) = 0
   .module (string) = Navigator
   .action (string) = default
]
... which shows the actionparams array and its keys -- including start_page, when set.

Aside: I wanted to get print_r and {get_template_vars} out there but a more normal approach might be to set a var in the calling template:

Code: Select all

{$jolly_green_giant='test'}
{Navigator start_page=$jolly_green_giant} 
... then $jolly_green_giant should be available in the Navigator template (if not, try {$jolly_green_giant='test' scope=global}). This approach is slightly less efficient but probably easier to read/maintain.
MZTech
Forum Members
Forum Members
Posts: 16
Joined: Tue May 28, 2013 10:51 am

Re: How to access page_start variable in Navigator

Post by MZTech »

Thank you again for all the information. It was very helpful.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: How to access page_start variable in Navigator

Post by rotezecke »

start_page="" - Starts the menu displaying at the given start_page and showing that element and it's children only. Takes a page alias.
Based on that description, I have a feeling that start_page is always equal to {$nodes[0]->alias}. Untested though.
Post Reply

Return to “CMSMS Core”