Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: <html tal:define="global base_url here/baseURL; template_id string:index; here python:here.restrictedTraverse('s/c/x/root/en-us/Help')"> <a href="?base_url/contactus.pt"> Please tell me what I'm doing wrong. TIA, Tony ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
--On 8. März 2007 12:48:26 -0500 tonylabarbara@aol.com wrote:
Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this:
How told you that? Please refer to the ZPT documentation in the Zope Book. -aj
On 3/8/07, tonylabarbara@aol.com <tonylabarbara@aol.com> wrote:
I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this:
Incorrect, you can only use ? to interpolate variables into a path expression: <span tal:define="foo string:bar" tal:content="here/?foo"></span> The above example will look up 'bar' and render it as the content of the span. -- Martijn Pieters
Thanks for clarifying that! Tony -----Original Message----- From: mj@zopatista.com To: tonylabarbara@aol.com Cc: zope@zope.org Sent: Thu, 8 Mar 2007 2:14 PM Subject: Re: [Zope] Calling a Variable On 3/8/07, tonylabarbara@aol.com <tonylabarbara@aol.com> wrote:
I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this:
Incorrect, you can only use ? to interpolate variables into a path expression: <span tal:define="foo string:bar" tal:content="here/?foo"></span> The above example will look up 'bar' and render it as the content of the span. -- Martijn Pieters ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
Martijn Pieters schrieb:
On 3/8/07, tonylabarbara@aol.com <tonylabarbara@aol.com> wrote:
I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this:
Incorrect, you can only use ? to interpolate variables into a path expression:
<span tal:define="foo string:bar" tal:content="here/?foo"></span>
The above example will look up 'bar' and render it as the content of the span.
I notice ZPT gets weirder and weirder... How many syntactic specialities will we add to path expressions? ;) Why not keep it simple? :-) Or make it simpler by removing even tal:define ... Regards Tino
On 3/9/07, Tino Wildenhain <tino@wildenhain.de> wrote:
I notice ZPT gets weirder and weirder... How many syntactic specialities will we add to path expressions? ;)
?var interpolation have been supported since the first checkin Evan Simpson made nearly 6 years ago, the feature has been a bit underdocumented, but it is not a recent addition.. -- Martijn Pieters
Tino Wildenhain wrote:
I notice ZPT gets weirder and weirder...
It's always been that weird ;-) If you want sanity, try Twiddler instead :-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Dnia czwartek, 8 marca 2007 18:48, tonylabarbara@aol.com napisał:
Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: You messed some things. First go to google.com and look into address bar in your browser. Then enter any value into search box (plz don't ask me what is "any" value ;) ) and click "search". Look into the address bar again. You will see there something like: google.com?variable_name=variable_value&another_variable_name=another_variable_value etc. google.com is in your case base_url, and things after ? and & are variables that are passed to server (in your case Zope) from your browser (via request).
<html tal:define="global base_url here/baseURL; template_id string:index; here python:here.restrictedTraverse('s/c/x/root/en-us/Help')"> Do you really want to define a variable named "here"?
<a href="?base_url/contactus.pt"> What you want here is: base_url/contactus.pt?variable=variable_value. To put a variable value into href attribute use tal:attributes="href ..."
Please tell me what I'm doing wrong. I tried to be a bit more specific that guys in other answers but please do what they suggested to you: read zope book :)
Tony
-- Jakub Wisniowski
tonylabarbara@aol.com wrote:
Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this:
<html tal:define="global base_url here/baseURL; template_id string:index; here python:here.restrictedTraverse('s/c/x/root/en-us/Help')">
redefining 'here' isn't a good idea...
<a href="?base_url/contactus.pt">
I think you meant: <a href="#" tal:attributes="href string:${base_url}/contactus.pt"> cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (6)
-
Andreas Jung -
Chris Withers -
eXt -
Martijn Pieters -
Tino Wildenhain -
tonylabarbara@aol.com