I'm trying to set up a dynamic redirect, and I can't figure out the syntax. Given there's a variable called 'record_id', and I have a page called 'edit' which takes a parameter called 'r_id', here's the redirect statement I'd like to use: <dtml-call expr="RESPONSE.redirect('edit?r_id=record_id')"> I need the record_id field to be evaluated, but the rest to be used literally. How do I do this? THX. -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Colin Fox wrote:
I'm trying to set up a dynamic redirect, and I can't figure out the syntax.
Given there's a variable called 'record_id', and I have a page called 'edit' which takes a parameter called 'r_id', here's the redirect statement I'd like to use:
<dtml-call expr="RESPONSE.redirect('edit?r_id=record_id')">
I need the record_id field to be evaluated, but the rest to be used literally. How do I do this?
<dtml-call expr="RESPONSE.redirect('edit?r_id='+record_id)"> this isn't dtml within dtml, this is python, and you add a fixed string and a string variable, so to say. cheers, oliver
On Thu, 2002-03-28 at 11:34, Oliver Bleutgen wrote:
Colin Fox wrote:
<dtml-call expr="RESPONSE.redirect('edit?r_id='+record_id)">
this isn't dtml within dtml, this is python, and you add a fixed string and a string variable, so to say.
Ah. Stupid of me. Well, it works perfectly now. Thanks! -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Glad you got it to work, here is another aproach A pure DTML way to do this is through the dtml-raise tag: http:// is a must have <dtml-raise type="Redirect">http://</dtml-raise> -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of Colin Fox Sent: Thursday, March 28, 2002 11:58 AM To: Oliver Bleutgen Cc: zope@zope.org Subject: Re: [Zope] DTML within DTML? On Thu, 2002-03-28 at 11:34, Oliver Bleutgen wrote:
Colin Fox wrote:
<dtml-call expr="RESPONSE.redirect('edit?r_id='+record_id)">
this isn't dtml within dtml, this is python, and you add a fixed string and a string variable, so to say.
Ah. Stupid of me. Well, it works perfectly now. Thanks! -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Assuming record_id is in request namespace (also assuming it is a number) Script(python) =============== url = 'edit?r_id=%d' % (context.REQUEST.record_id) context.REQUEST.RESPONSE.redirect(url) you'll want to use full paths in the redirect, I know it works like that but by rule it should be the full url. So, then you'll want to use the same method to add in the base url from REQUEST.BASE0 or whichever one is required. then in dtml do: <dtml-call your_script> if it is not in request pass it as a parameter. <dtml-call "your_script(r_id=record_id)"> -- Jeffrey D. Peterson Webmaster & Resident Standards Warrior "The Trouble with doing anything right the first time is that nobody appreciates how difficult it was."
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Colin Fox Sent: Thursday, March 28, 2002 1:30 PM To: zope@zope.org Subject: [Zope] DTML within DTML?
I'm trying to set up a dynamic redirect, and I can't figure out the syntax.
Given there's a variable called 'record_id', and I have a page called 'edit' which takes a parameter called 'r_id', here's the redirect statement I'd like to use:
<dtml-call expr="RESPONSE.redirect('edit?r_id=record_id')">
I need the record_id field to be evaluated, but the rest to be used literally. How do I do this?
THX.
-- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
participants (4)
-
Colin Fox -
Jeff Peterson -
Oliver Bleutgen -
zopedan