Re: Photo Product fix/question/suggestion
This should work: <dtml-var "blah(REQUEST, class='fooimage', alt='[Can't use dtml tags inside dtml tags]', pdcookie='1')">
Zope spits out the following:
Expression (Python) Syntax error: invalid syntax
, for tag <dtml-var "blah(REQUEST, class='fooimage', alt='[Can't use dtml tags inside dtml tags]', pdcookie='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='your text', pdcookie='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='1', alt='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='1', alt='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.
----- Original Message ----- From: "Andrew Lahser" <andrew@apl-software.com> Perhaps this will be a little more clear. Here is the relevant hierarchy: ==Classes in my product section== TrumpFolderClass --- TrumpClass ------- index_html ** ------- [property sheet] ----------- name ----------- image ----------- description ==Objects on my site== Trumps (my TrumpFolderClass instance) --- trump1_info (TrumpClass instance, image="trump1.jpg") --- trump1.jpg (Photo instance) --- trump2_info (TrumpClass instance, image="trump2.jpg") --- trump2.jpg (Photo instance) ** index_html is where I'm writing this code to render the Photo. That way, viewing trump1_info or trump2_info loads the proper image.
Perhaps this will be a little more clear. Here is the relevant hierarchy:
==Classes in my product section==
TrumpFolderClass --- TrumpClass ------- index_html ** ------- [property sheet] ----------- name ----------- image ----------- description
==Objects on my site==
Trumps (my TrumpFolderClass instance) --- trump1_info (TrumpClass instance, image="trump1.jpg") --- trump1.jpg (Photo instance) --- trump2_info (TrumpClass instance, image="trump2.jpg") --- trump2.jpg (Photo instance)
** index_html is where I'm writing this code to render the Photo. That way, viewing trump1_info or trump2_info loads the proper image.
Sure. I think I get your problem now. Try this. <dtml-with "_.getitem(image, 0)"> <dtml-var "tag(REQUEST, pdcookie='1', alt='your alt text')"> </dtml-with> Drew
----- Original Message ----- From: "Andrew Lahser" <andrew@apl-software.com> To: "Gregor" <vorlon@iglou.com>
Sure. I think I get your problem now. Try this.
<dtml-with "_.getitem(image, 0)"> <dtml-var "tag(REQUEST, pdcookie='1', alt='your alt text')"> </dtml-with>
Hooray! That works for getting the image and the HTML cookie setting thing onto the page ... ... except for one bit. When I try to add the HTML/CSS attribute "class" to the mix, it once again gives: --- invalid syntax , for tag <dtml-var "tag(REQUEST, pdcookie='1', alt='my alt text', class='trumpimage')">, on line 6 of index_html --- Looking at this line, I can see nothing wrong with it syntax-wise, unless I have to do something weird to use "class". Maybe you can see what I cannot. - Gregor
participants (2)
-
Andrew Lahser -
Gregor