I have a typical News dialog with title, subtitle, lead text, text, and a
couple images. This information appears in various pages in various formats:
In the home page the 2 newest news items appear with photo, title and subtitle.
In the news list page all (or many) news items appear with image, title and
lead text.
In the news item page one news item appears with ... well, everything.
Questions:
1. What's the best way to do this. I started out doing this in the Home page:
[#assign newsItems=mgnl.inherit(content).homePageNewsCollection /]
[#list newItems?children! as kid]
[@cms.includeTemplate contentNode=kid /]
[/#list]
[@cms.newBar contentNodeCollectionName="homePageNewsCollection"
paragraph="homePageNews" /]
... which works fine - the 2 newest news items appear with photo, title and
subtitle..
But I tried doing the same thing in a different page. And it prints the data
but with the same format as the home page! In my Magnolia ignorance I didn't
realize that when you save the date you are also saving its paragraph type with
it.
If I change the new bar line to this:
[@cms.newBar contentNodeCollectionName="homePageNewsCollection"
paragraph="newsListPageNews" /]
... any new data entered will be displayed correctly on the news list page. But
the old ones are still displayed with the home page format. Furthermore, that
new data will be shown on the home page with the news list format!
The same goes for the news item page.
All of this prolog is to ask: how do you display the same info in different
formats (using different paragraphs, all linked to the same dialog) on
different pages?
For the time being I am doing it like this, for example in my news list page:
[#assign newsItems=mgnl.inherit(content).homePageNewsCollection /]
[#list newItems?children! as kid]
${kid.title}<br>
${kid.subTitle}
[/#list]
... but I am not sure if this is a good idea.
2. How do you access the JCR id for an item? I would like to pass the id for a
given news item via the url and then only show the info for that news item.
Something like this:
[#assign newsItems=mgnl.inherit(content).homePageNewsCollection /]
[#list newItems?children! as kid]
[#if kid.id! == ctx.parameters.id!]
${kid.title}<br>
${kid.subTitle}
[/#if]
Is this the way to do it?
Sorry for the long post. All this stuff is already done in the STK, I realize I
am re-inventing the wheel. But I am not really sure how to see the 'source
code' (ftl files) for all the STK stuff.
Anyway, I am sure question 2 is simple enough I just can't find the answer.
Question 1 on the other hand ... not sure how to go about it.
Thanks!
Bob
[/#list]
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=79c9f527-c5e9-4eb9-b96f-019661451ba4
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------