Re: Smart Navigation Using Smarty ?
| From: | Monte Ohrt | Date: | Thu, 01 Mar 2001 17:02:34 +0000 |
| Subject: | Re: Smart Navigation Using Smarty ? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-255@lists.php.net to get a copy of this message | ||
Jim Harlindong wrote:
>
> Sorry my mistake it was <%/if%>
> I think I'll stick to <% %> as DW cooperates well with ASP tags.
>
> Another question or suggestion.
>
> I have a common navigation buttons at the top or on the left side, let's say
> 3 buttons:
>
> Home
> Search
> Contact
>
> these are inside a file called nav.tpl
>
> Say those are image buttons, or it could also be a text link.
>
> So if I am include nav.tpl in all the three other templates (home, search
> and contact) the resulting page will have a link even to its own. e.g. on
> the Home page people can click on Home.
>
> I hope you can understand what I am trying to say :)
>
> Is there a way so that Smarty will conditionally include certain code / part
> depending on current page, ideally have an easy way to say
>
> {current page="index.php"}
> <b>home</b>
> {current_else}
> <a href="index.php">Home</a>
> {/curent}
Put your navigation in a nav.tpl file, something like this:
{if $page ne "home"}
... home button ...
{/if}
{if $page ne "search"}
... search button ...
{/if}
{if $page ne "contact"}
... contact button ...
{/if}
Then when you include the template, pass the variable
{include file="nav.tpl" page="home"}
>
> Regards,
> Jimmy
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/