Questions tagged [zpt]

Zope Page Templates are an HTML/XML generation tool.

Zope Page Templates are a web page generation tool. They help programmers and designers collaborate in producing dynamic web pages for Zope web applications. Designers can use them to maintain pages without having to abandon their tools, while preserving the work required to embed those pages in an application.

Documentation: http://docs.zope.org/zope2/zope2book/ZPT.html

Tag usage

When asking questions about the template language, consider adding and / or tags as well, as appropriate.

56 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
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
5
votes
1 answer

Jinja SandboxedEnvironment and Zope2 Restricted Python

Jinja's sandbox and the Zope 2 RestrictedPython seem to solve similar problems. Is there a way to layer them, i.e. use RestrictedPython policies in a Jinja environment? The use case is retrofitting Jinja templates to an existing Zope2-based product,…
Alex Morega
  • 4,132
  • 1
  • 24
  • 25
3
votes
2 answers

Plone configuration

Plone is showing the special chars from my mother language (Brazilian Portuguese) in its pages. However, when I use a spt page I created it shows escape sequences, e.g.: Educa\xc3\xa7\xc3\xa3o instead of Educação (by the way, it means Education).…
HelioAraujo
  • 227
  • 1
  • 10
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
3
votes
2 answers

Storing data in HTML tags as custom attributes

Is it a good practice storing related information in the HTML tag? $("#my_div").append(""); $("#info").attr("boo"); I've encountered with such technique (and slightly borrowed it) in TAL (in ZPT) where you could use…
rook
  • 5,880
  • 4
  • 39
  • 51
3
votes
2 answers

Line Breaking in Chameleon

I have used the pyramid framework to build a large web application. Among other things, this application allows the user to enter text into a text area form field. This text is then saved to a database and of course can be readout again and…
Meneldur
  • 215
  • 1
  • 5
3
votes
1 answer

Changing attributes in Zope templates

I'm writing a template for an object that contains files. I'm following the theme building blocks instructions. foo That makes that the liks downloads the file, as this: foo But I want that…
Daniel Hernández
  • 1,279
  • 8
  • 15
3
votes
1 answer

Ignore XML Namespace (TAL) in SublimeLinter

I'm using SublimeText 2 and SublimeLinter, and I develop for Zope and Plone. In the page templates (.pt) I get lots of errors for namespace problems, which I would like to either fix or have SublimeLinter ignore. For example:
Spanky
  • 5,608
  • 10
  • 39
  • 45
2
votes
2 answers

How to retrieve the value of a key in a dictionary using a variable defined in TAL?

I have defined a dictionary in python: tal:define="dic python:{'a':'1', 'b':'2'};" I have another variable defined using tal:define called var, which is either 'a' or 'b'. I get an error when I try to do: tal:define="foo…
JCarter
  • 407
  • 3
  • 11
2
votes
1 answer

CSS / ZPT / Plone

I tried using CSS in ZPT page for Plone. The only way it worked was as inline css. Using the style tag in the header didn't work, neither trying to use a linked css file. Is there a way to do it?
HelioAraujo
  • 227
  • 1
  • 10
2
votes
3 answers

Condition depending other field

i have 2 fields (fieldA and fieldB) what i want : - if the fieldA contains something then the fieldB should not be displayed what i try : so…
bklups
  • 101
  • 1
2
votes
2 answers

Pyramid Chameleon template security for HTML and Javascript

Do Chameleon templates escape/strip XSS and HTML tags for variables? Would the following be safe?