We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Tome Module: How to Add {count} to static_tome_path

Development and Programming

Eric Barstad's avatar
Eric Barstad
198 posts
18 years ago
Eric Barstad's avatar Eric Barstad

I was wondering if a {count} variable could be added to the static_tome_path plug-in for the Tome module. Basically, I’m trying to spit out a nav that looks like this, where each link is given a unique class based on {count}:

<div id="mainnav">
   <ul>
   {exp:static_tome_path direction="post" page="0" depth="1" nest="false"}
    <li><a href="http://{url_title}class=page_{count}">{title}</a></li>
   {/exp:static_tome_path}
   </ul>
</div>

Or is there a way I can fake a {count} variable using PHP in my template?

       
Eric Barstad's avatar
Eric Barstad
198 posts
18 years ago
Eric Barstad's avatar Eric Barstad

Well, my PHP isn’t what it should be, but a bit of experimenting paid off. So simple it hurts:

<?php $count = 1; ?>
<div id="mainnav">
   <ul>
   {exp:static_tome_path direction="post" page="0" depth="1" nest="false"}
    <li><a href="http://{url_title}class=page_<?=$count++?>">{title}</a></li>
   {/exp:static_tome_path}
   </ul>
</div><!-- #mainnav -->
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.