Re: #foreach and page iterators
Anthony Eden <[email protected]> Wed, 22 Jan 2003 00:58:08 -0500
| Newsgroups | gmane.comp.java.jpublish.devel |
|---|---|
| Message-ID | <[email protected]> |
Responses inline... Florian Gnägi wrote: > Hi Andrew > > Try putting your code in a page action where you could extract all titles of pages > and other properties from other pages and push them in the context from within your page. > > To get all page titles looks like a functionality problem an not like a layout issue. > In my point of view it should therefore be placed in a page action that calculates an > array with the page names and maybe some other stuff like the date when the page has > ben updated last time etc. The velocity macro can then be used to iterate over the array > it gets from the page-action and solve the layout issue. Florian is correct: it is best to do all logic like this in an action as opposed to in the Velocity code. You will have a lot more flexibility in the action, plus you can reuse your code that way. > > What I miss in the page property system are global properties that could be defined in > the pages.xml file but not within a specific page tag. This would allow to have common > properties like 'save', 'update', 'edit', 'new' 'home' etc. In our case we use an > internationalization class that reads this properties from a properties file. This is not > so nice since it should be provided by the framework. Maybe it's already there and we didn't find it? No, there is nothing right now to have common properties. I would rather not put them in pages.xml though because that file is only used when using the XMLPageManager. Or at least I would first like to come up with a way to do it using the default page manager. I'll think about it for a bit and see where it would best fit. > > Sincerly > -Florian > > ----- Original Message ----- > From: "Andrew Speakman" <[email protected]> > To: <[email protected]> > Sent: Tuesday, January 21, 2003 6:11 PM > Subject: [JPublish-developer] #foreach and page iterators > > > | > | JPublish looks like a great framework but I am struggling with one aspect. > | > | I would like to iterate through a group of page definitions to extract a > | list of titles and other properties. Something like this ... > | > | #foreach ( $topic in $site.getPageManager().getPages("/topics") ) > | <p>Topic title: > | $site.getPageManager().getPage("$topic").getProperty("title")</p> > | #end > | > | This throws up a number of errors but I am wondering if it is possible for > | the Velocity #foreach directive to do this, given that getPages() returns an > | Iterator rather than a reference to a List. > | > | Andrew Speakman > | > | > | > | ------------------------------------------------------- > | This SF.net email is sponsored by: Scholarships for Techies! > | Can't afford IT training? All 2003 ictp students receive scholarships. > | Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. > | www.ictp.com/training/sourceforge.asp > | _______________________________________________ > | Jpublish-developer mailing list > | [email protected] > | https://lists.sourceforge.net/lists/listinfo/jpublish-developer > | N¬HY޵隊X¬²š'²ŠÞu¼’r%j»!Š›¢´Þrž°&§µ§ß¢·HNÚÚŠx§€ eÛM7‰Ëi²Ûz{lÂçŠ÷¬r%j»!Š›zØZÛ(žÚÚŠx§‚)̉Ê貇à > +¡+§.)îÇõ > !v§vj+{0‰Ëir‰¿¶¶¢ž)à þÊ.ÂÇŸ¢¸jÊI¦æåŠÈ]z÷¥¢—«™¨¥Šx%ŠËI¦æåŠÈ]z÷¥¢—«–+-²Ê.ÂÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Å wèþ:nnX¬…ׯzZ)er== ------------------------------------------------------- This SF.net email is sponsored by: Scholarships for Techies! Can't afford IT training? All 2003 ictp students receive scholarships. Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. www.ictp.com/training/sourceforge.asp