[Zope] How do I do this using Zope?
bruno desthuilliers
bruno at modulix.org
Mon Mar 6 09:16:58 EST 2006
John Poltorak wrote:
(reposted to zope.org)
> Hi,
>
> On Mon, Mar 06, 2006 at 02:08:10PM +0100, bruno desthuilliers wrote:
>
>>John Poltorak wrote:
>>
>>>I would like to create a folder (news) which contains several news items,
>>>lets say news1, news2, news3.
>>>
>>>I would like to set up a menu box which lists all the news items in
>>>the news folder which when clicked on would load each one up.
>>>
>>>
>>>How do I code this up? (Hope someone understands what I'm getting at)
>>>
>>
>>What's your question exactly ? How to create a new Folder-like type and
>>the related news type ? How to create the html for the menu ? Something
>>else ?
>
>
> Forget 'news' for the moment, I was just using it as an example.
>
> What I wanted to do was create a folder where I could place objects
Quite simple for now: create a folder and place objects inside !-)
> and
> have them automatically appear on a selectable menu.
You mean a menu of links, or a select in a field ?
>
> As an example I might have an 'events' folder where I had objects event1,
> event2, event3 so would want to see a list of selectable objects on a
> particular menu.
news.objectValues(['event']) method will give you the list of objects
with meta_type 'event' contained in the folder with id 'news'. So
Andrew's answer was almost ok:
<tal:block define="news python: context.news.objectValues(['event']" >
<ul tal:condition="news" tal:repeat="new news" >
<li>
<a tal:attributes="href news/absolute_url"
tal:content="news/title">Link</a>
</li>
</ul>
</tal:block>
(replace html markup with what appropriate of course...)
NB: see also objectIds() and objectItems() in the doc.
HTH
--
bruno desthuilliers
développeur
bruno at modulix.org
http://www.modulix.com
More information about the Zope
mailing list