473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Kid templating

micmast
144 100+
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
1 1130
micmast
144 100+
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

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

Similar topics

5
by: Roger Jack | last post by:
I have just finished reading Code Generation In Action which uses Ruby for code generation. I would like to use Python instead. Is Cheetah the best tool to use for templating source code files and...
31
by: Leif K-Brooks | last post by:
I'm planning to start on a fairly large web application, most likely using mod_python. I recently wrote a fairly small (but real-world useful) web app with it, and all of those req.write()s made...
7
by: Ksenia Marasanova | last post by:
Hi, I am looking for fast, simple templating system that will allow me to do the following: - embed Python code (or some templating code) in the template - generate text output (not only...
2
by: lloyd christopher | last post by:
im developing a template based web application in perl and need some guidance. currently its all pretty simple stuff, we tell the designers place holders to use and then &username; or %USERNAME%...
1
by: Chris Ashley | last post by:
I have been looking into templating systems these past few days, but nothing seems to suit my purpose. I want to achieve complete separation of code and design in a templating system, so a designer...
18
by: pkassianidis | last post by:
Hello everybody, I am in the process of writing my very first web application in Python, and I need a way to generate dynamic HTML pages with data from a database. I have to say I am...
0
by: Chris Withers | last post by:
Hi All, I'm proud to announce that after almost a year's development, the first public release of Twiddler is available! Twiddler is a simple but flexible templating system for dynamically...
7
by: Paul | last post by:
I have been coding apps with PHP for several years. But I am getting more involved in larger and more complicated PHP applications and want to use best practices. I use Eclipse's PHP IDE. I...
5
by: jmDesktop | last post by:
Hi, I was using .net and it uses templates. I like that it did not mix the UI with logic. I saw there are many templating engines for php usage. Can you recommend one? I don' t know which to...
10
by: Terrence Brannon | last post by:
Hello, The most common way of dynamically producing HTML is via template engines like genshi, cheetah, makotemplates, etc. These engines are 'inline' --- they intersperse programming...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.