[Zope] Re: Photo Product fix/question/suggestion
Andrew Lahser
andrew@apl-software.com
Mon, 10 Jan 2000 22:48:19 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_00C5_01BF5BBC.CA253AC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
> > This should work:
> > <dtml-var "blah(REQUEST, class=3D'fooimage', alt=3D'[Can't use dtml =
tags
inside
> > dtml tags]', pdcookie=3D'1')">
>
> Zope spits out the following:
>
> Expression (Python) Syntax error:
> invalid syntax
>
> , for tag <dtml-var "blah(REQUEST, class=3D'fooimage', alt=3D'[Can't =
use dtml
tags
> inside dtml tags]', pdcookie=3D'1')">, on line 6 of index_html
>
> It gives the same error if I use the other version.
I hope that you did not take my example literaly. I included an extra
apostrophe (')
in the example that would give a syntax error. Here is a simplier =
example.
<dtml-var "blah(REQUEST, alt=3D'your text', pdcookie=3D'1')">
Add all the additional tags that you would want. Remember that blah =
needs to
be photo object, not an attribute with the name of the photo
> > Let me know right away if this doesn't work for you.
>
> The *major* problem I am suffering is that I don't know what "blah" is =
in
my
> method, so the above doesn't work.
>
> The ZClass FooImage has a property "image".
> Inside the image property for a given instance, I stick the ID of the
proper
> photo object.
> My DTML is in the index_html method of FooImage.
>
> I don't know how to tell DTML to grab the object referred to by =
"image"
(as
> opposed to the string CONTENTS of the "image" property, which is what =
it
does
> right now, I assume). If I just plug in the Property name as in
> "image(REQUEST", then it gives a "call of non-function" error.
>
If I understand your problem correctly, you should be able to do this.
<dtml-with blah> # blah is an attribute of the index_html document
<dtml-var "tag(REQUEST, pdcookie=3D'1', alt=3D'your text')">
</dtml-with>
Also, you could loop through all the Photos in a container as follows.
<dtml-in "objectValues('Photo')">
<dtml-var "tag(REQUEST, pdcookie=3D'1', alt=3D'your text')">
</dtml-in>
> > > Alternately, figuring out how to use this "pdcookie" feature from =
a
normal
> > > <img> tag would work too.
The pdcookie feature is nothing more than a switch to spit out some =
html.
Feel
free to copy that anywhere you need. The trick is to set the cookie in =
the
user's browser.
------=_NextPart_000_00C5_01BF5BBC.CA253AC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>> > This should work:<BR>> =
>=20
<dtml-var "blah(REQUEST, class=3D'fooimage', alt=3D'[Can't use dtml=20
tags<BR>inside<BR>> > dtml tags]', =
pdcookie=3D'1')"><BR>><BR>> Zope=20
spits out the following:<BR>><BR>> Expression (Python) Syntax=20
error:<BR>> invalid syntax<BR>><BR>> , for tag <dtml-var=20
"blah(REQUEST, class=3D'fooimage', alt=3D'[Can't use =
dtml<BR>tags<BR>> inside=20
dtml tags]', pdcookie=3D'1')">, on line 6 of =
index_html<BR>><BR>> It=20
gives the same error if I use the other version.<BR>I hope that you did =
not take=20
my example literaly. I included an extra<BR>apostrophe (')<BR>in the =
example=20
that would give a syntax error. Here is a simplier =
example.<BR><BR><dtml-var=20
"blah(REQUEST, alt=3D'your text', pdcookie=3D'1')"><BR><BR>Add all =
the additional=20
tags that you would want. Remember that blah needs to<BR>be photo =
object, not an=20
attribute with the name of the photo<BR><BR>> > Let me know right =
away if=20
this doesn't work for you.<BR>><BR>> The *major* problem I am =
suffering is=20
that I don't know what "blah" is in<BR>my<BR>> method, so the above =
doesn't=20
work.<BR>><BR>> The ZClass FooImage has a property =
"image".<BR>> Inside=20
the image property for a given instance, I stick the ID of =
the<BR>proper<BR>>=20
photo object.<BR>> My DTML is in the index_html method of=20
FooImage.<BR>><BR>> I don't know how to tell DTML to grab the =
object=20
referred to by "image"<BR>(as<BR>> opposed to the string CONTENTS of =
the=20
"image" property, which is what it<BR>does<BR>> right now, I =
assume). =20
If I just plug in the Property name as in<BR>> "image(REQUEST", then =
it gives=20
a "call of non-function" error.<BR>><BR>If I understand your problem=20
correctly, you should be able to do this.<BR><dtml-with blah> # =
blah is an=20
attribute of the index_html document<BR> <dtml-var =
"tag(REQUEST,=20
pdcookie=3D'1', alt=3D'your =
text')"><BR></dtml-with><BR><BR>Also, you could=20
loop through all the Photos in a container as =
follows.<BR><BR><dtml-in=20
"objectValues('Photo')"><BR> <dtml-var "tag(REQUEST, =
pdcookie=3D'1',=20
alt=3D'your text')"><BR></dtml-in><BR><BR>> > > =
Alternately,=20
figuring out how to use this "pdcookie" feature from a<BR>normal<BR>> =
>=20
> <img> tag would work too.<BR><BR>The pdcookie feature is =
nothing more=20
than a switch to spit out some html.<BR>Feel<BR>free to copy that =
anywhere you=20
need. The trick is to set the cookie in the<BR>user's=20
browser.<BR><BR><BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_00C5_01BF5BBC.CA253AC0--