By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,089 Members | 2,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,089 IT Pros & Developers. It's quick & easy.

Kid templating

micmast
100+
P: 144
Hey,

I'm trying to create a template using Kid, but I have a small problem.
Expand|Select|Wrap|Line Numbers
  1. <li><a href="/">Home</a></li>
  2. <li><a href="test/">Test</a></li>
  3.  
Now I have a css class "selected" that highlights the link. So that would be
Expand|Select|Wrap|Line Numbers
  1. <li><a href="/" class="selected">Home</a></li>
  2. <li><a href="test/">Test</a></li>
  3.  
Now I'm trying to convert that into a kid template and the class attribute has to be set if a variable has a certain value.

I tried using

Expand|Select|Wrap|Line Numbers
  1. <li  py:if="value_of('active', 'test')"><a href="test/" py:attrs="{'class':'selected'}" >Test</a></li>
  2.  
and
Expand|Select|Wrap|Line Numbers
  1. <li><a href="test/"   py:if="value_of('active', 'test')" py:attrs="{'class':'selected'}" >Test</a></li>
  2.  
But these things don't work and google doesn't come up with any good answer. Does the py:if only work with block elements?

Thx in advance
Mar 21 '08 #1
Share this Question
Share on Google+
1 Reply


micmast
100+
P: 144
I found a fix, not exactly beautifull but it works:

the template:
Expand|Select|Wrap|Line Numbers
  1. <ul py:for='item in pluginlist'>
  2.     <li><a href="../input/${item[0]}" class="${item[1]}">${item[2]}</a></li>
  3.     </ul>
  4.  
and pluginlist is an array with the correct values filled in.
Mar 25 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.