Python and Zope

Magnus nixx at telia.com
Sun Oct 7 15:57:27 CEST 2001


maxm wrote:

> "Magnus" <nixx at telia.com> ...
> 
>>  When using <dtml-var myObject> to 'include' files/objects it is working
>> well if the files are in the same directory.
> 
> Your question can mean several different things, i'll try to answer them.
> 
> If you want to build a news site with articles in different folders like:
> 
> home/
>     general/
>         article1
>         article2
>         article3
>     computers/
>     Hifi/
>         article4
>     Politics/
>         article5
>         article6
> 
> And if you then want to have a list of all the articles on the front page
> you could either traverse the folders manually
> 
> <dtml-call "REQUEST.set('all_articles', general.objectValues() +
> conmputers.objectValues() + Hifi.objectValues() +
> Politics.objectValues())"> <dtml-in all_articles>
>     <a href="<dtml-var absolute_url>"><dtml-var title_or_id></a><br>
> </dtml-in>
> 
> Or you could use the Catalog to to list the articles. This is probably the
> best way to do it in the long run and it will be faster too.
> 
> regards Max M


Thanks Max,

great stuff though I was looking for a different answer but this is also 
something I need.

I was more after an answer where you are composing a page with several 
objects (sorry if I use the wrong notation I'm a newbie in Python and Zope) 
like:

<dtml-var standard_html_header>
<dtml-var zope_quick_start>
<dtml-var standard_html_footer>

But in my case I have some images, and script in various folders hence I 
would like to do something like:

<dtml-var includes/my_header>
<dtml-var images/my_picture>
<dtml-var includes/my_footer>

(But this syntax is wrong.)

Should it be something like:

<dtml-var expr="BASE1">includes/my_header
<dtml-var expr="BASE1">images/my_picture
<dtml-var expr="BASE1">includes/my_footer

(I just found some objects that might be useful but haven't tried them out 
yet e.g. RESPONSE, REQUEST and so forth.)

Thanks,
Magnus




More information about the Python-list mailing list