Firefox PHP

Navigation: Getting variable for current page

Posted by nils73 
Navigation: Getting variable for current page
January 19, 2007 08:34AM
I have been searching the forum for hours now, trying to find some more help about templates and variables that can be used. Above all I am looking for something to set the current page so that I can do the following:

{IF URL->SEARCH}
<li><a href="{URL->SEARCH}">{LANG->Search}</a></li>
{ELSE}
<li class="active">{LANG->Search}</li>
{/IF}

But not only for search, but for anything inside navigation. Any ideas, hints or things I have missed throughout my search?

Regards,
Nils
Re: Navigation: Getting variable for current page
January 19, 2007 10:54AM
You can use the phorum_page definition for that, which is set on every page. What I did in my own template is set $PHORUM["DATA"]["PHORUM_PAGE"] to the phorum_page value. So my header.tpl starts with:

<?php $PHORUM["DATA"]["PHORUM_PAGE"] = phorum_page ?>

After that, I can use the following type of construction in the template navigation:

{IF PHORUM_PAGE search}
  <li><a href="{URL->SEARCH}">{LANG->Search}</a></li> 
{ELSE}
  <li class="active">{LANG->Search}</li> 
{/IF}

If you need to know the phorum_page, then look at the start of the script that is opened in your browser or add a {PHORUM_PAGE} statement to the template, so the page will be printed on screen.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Navigation: Getting variable for current page
January 19, 2007 11:43AM
Maurice,

thanks for the quick help! However, I guess it must be

{IF PHORUM_PAGE "search"}
  <li><a href="{URL->SEARCH}">{LANG->Search}</a></li> 
{ELSE}
  <li class="active">{LANG->Search}</li> 
{/IF}

because without the quotation-marks around "search" it did not work. However now it works well and things are getting easier now.

Regards,
Nils
Sorry, only registered users may post in this forum.

Click here to login