Questions tagged [template-tal]

TAL (Template Attribute Language) is a XML-attribute based templating language standard, used by Zope Page Templates, Chameleon, PHPTAL and other templating libraries.

TAL (Template Attribute Language) is a XML-attribute based templating language standard, used by Zope Page Templates, Chameleon and other templating libraries.

A sister language METAL (Macro Expansion Template Attribute Language) adds macro capabilities to TAL; use the tag for questions specific to macro handling.

The language is aimed at making collaboration between designers and programmers easier, by hiding all templating constructs in XML or HTML attributes, allowing a template editor to create and maintain templates that still render in a browser.

Use this tag for general TAL syntax questions. Consider using the , or tags as needed if the question is specific to an implementation.

90 questions
53
votes
1 answer

How to create zebra-stripe CSS with TAL?

How can I use Chameleon or Zope Page Templates to easily create CSS zebra striping? I want to add odd and even classes to each row in a table, but using a condition with repeat/name/odd or repeat/name/even looks rather verbose even with a…
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
8
votes
3 answers

How do I conditionally add an id attribute in TAL (PHPTAL)?

I'm creating a form elements template file in PHPTAL. I would like to be able to OPTIONALLY pass in an id attribute for a field... So far the code looks like this:
7
votes
3 answers

Override only the Description field of the Plone standard content type

I would like to ovverride only the "view" of the classic "description field" of the Plone standard content type (Document, Folder, blabla), cause I need to "structure" the text of this field with structured text like: This is my…
Vito
  • 1,201
  • 1
  • 10
  • 16
6
votes
4 answers

When to use nocall on my tal:condition?

I know that for performance it's good practice to use nocall on a in order to avoid calling an object. Would appreciate (links to) a bit of background as this sounds a little vague to me :-) So when do you use nocall? Can it hurt to…
dimboo
  • 145
  • 7
6
votes
1 answer

How can my chameleon template accept message flashes from the pyramid framework?

I'm learning pyramid and it seems they are trying to get people to use chameleon instead of mako so I thought I'd give chameleon a chance. I like it so far and I can do basic things in the template such as if and for loops but I'm not sure how to…
Lostsoul
  • 25,013
  • 48
  • 144
  • 239
4
votes
1 answer

Pyramid, Chameleon and template rendering

I started a project with the Python web framwork 'Pyramid', using the template engine 'chameleon'. I'm a beginner of this frameworks, but I have to use it for a customer. I follow the steps in order to install the framework, then I started coding,…
4
votes
1 answer

Python Pyramid - Add multiple chameleon base templates

I am using this procedure to use a base template which the other templates can derive from. How can I create multiple base templates?
Sukumar
  • 3,502
  • 3
  • 26
  • 29
4
votes
1 answer

Pyramid and Chameleon ZPT

I'm new to web development and am trying to make a simple webpage in python using Pyramid. I've run into a bit of a snag though when it comes to making template files using Chameleon. What I'm trying to do right now is very simple. The view callable…
dpuzz
  • 41
  • 2
4
votes
2 answers

Python Pyramid & Chameleon templating language escapes html

I can't make sense of chameleon's tags. I'm a django user, but decided to introduce my CompSci course mates and myself to Pyramid, since I though more lightweight = easier to learn. At the moment the ${} tag is escaping any html tags I'm trying to…
rdrey
  • 9,379
  • 4
  • 40
  • 52
4
votes
2 answers

Zebra Striping with PHPTAL?

I'm trying out PHPTAL and I want to render a table with zebra stripes. I'm looping through a simple php assoc array ($_SERVER). Note that I don't want to use jQuery or anything like that, I'm trying to learn PHPTAL usage! Currently I have it working…
starmonkey
  • 3,147
  • 2
  • 20
  • 15
4
votes
1 answer

How do I conditionally add a class to a block item inside a repeat loop with Chameleon

I am just getting started with pyramid and chameleon templates. I have the following code example that renders a site menu.
  • ${menu.title}
  • cstrutton
    • 5,667
    • 3
    • 25
    • 32
    3
    votes
    1 answer

    using base layout templates in chameleon

    In the pyramid docs there is a nice tutorial on UX stuff here: http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/humans/creatingux/step07/index.html One thing I noticed though is in the tutorial they are setting up and passing…
    lostdorje
    • 6,150
    • 9
    • 44
    • 86
    3
    votes
    1 answer

    ajax widgets in pyramid and chameleon

    I would like to be able to easily create ajax 'widgets' backed by chameleon and pyramid on the server side. Does Pyramid provide any plumbing code that would make writing widgets easy? My current approach is I have a home view which uses home.pt as…
    lostdorje
    • 6,150
    • 9
    • 44
    • 86
    3
    votes
    3 answers

    How to set multiple values for the same attribute in tal:attributes using TALES

    I'm trying to set multiple css classes on one element. Unfortunately this doesn't work, as it returns: LanguageError: Duplicate attribute name in attributes.
    3
    votes
    3 answers

    How do I check if it's the homepage in a Plone website using ZPT?

    I want to change my website's header only it if's not the homepage. Is there a tal:condition expression for that? I've been reading this and can't find what I'm looking for... thanks!
    bchhun
    • 18,116
    • 8
    • 28
    • 31
    1
    2 3 4 5 6