I would recommend handling the current page navigation using CSS. Here is a
great article on how to do it:
http://hicksdesign.co.uk/journal/highlighting-current-page-with-css. The
idea is that you use a body CSS class instead of using a bunch of if
statements.

-Vincent


On Mon, Feb 25, 2013 at 4:04 PM, Derek Hildreth <[email protected]> wrote:

> As a newbie to chameleon templating, I'm trying to relate things I used to
> do in PHP to my main template.  I'm having a hard time coming up with ways
> to handle navigation on a page as far as highlighting the current page.
>  For example, in PHP, I would use something similar to the code:
>
>         <nav>
>           <ul>
>             <li <? if ($current_page=="Home") echo
> "class=\"current_page_item\"";?>>
>               <a href="index.php">Home</a>
>             </li>
>             <li <? if ($current_page=="Products") echo
> "class=\"current_page_item\"";?>>
>               <a href="products.php">Products</a>
>             </li>
>             <li <? if ($current_page=="Company") echo
> "class=\"current_page_item\"";?>>
>               <a href="company.php">Company & Contact</a>
>             </li>
>           </ul>
>         </nav>
>
> How might I apply this concept to a chameleon template?  Is there a
> better, or more pythonic/pyramidic/chameleonic way of doing this other than
> 'if/then' statements within the template?  I'm thinking it would be best to
> keep the view logic and view templates separate.
>
> Please let me know if I'm not clear enough.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Vincent Catalano
Software Engineer and Web Ninja,
(520).603.8944

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to