Re: List Displaying Child Content
Guillaume Kuhmel <[email protected]>
| Newsgroups | gmane.comp.cms.jahia.template |
|---|---|
| Message-ID | <[email protected]> |
Hello Christopher,
I've done a similar thing
in a page, masterPage.jsp, a left menu is used to add new children pages:
<%@ include file="leftmenu.inc"%> (it's the .inc from the jahia templates)
Then a scriptlet is used to access the children of the page:
<%
int id = jPage.getID();
JahiaField jDescription;
JahiaField jTitle;
String description = "";
String title = "";
String url = "";
%>
<%
Enumeration childs = jPage.getChilds();
while (childs.hasMoreElements()) {
JahiaPage laPage = (JahiaPage)childs.nextElement();
id = laPage.getID();
url = jData.params().composePageUrl(id);
jTitle = jData.fields().getAbsoluteField("title",id);
if (jTitle != null)
title = jTitle.getValue();
else
title = "";
jDescription =
jData.fields().getAbsoluteField("description",id);
if (jDescription != null)
description = jDescription.getValue();
else
description = "";
%>
<h2>Page:<%= id %>, <%= title %></h2><br>
<%= description %>
<a href='<%= url %>'><%= laPage.getTitle() %></a>
<hr>
<%
}
%>
the template of the children, named rubrique.jsp, contains 2 fields,
title and description, that a displayed in the mother page;
.....
<!-- ==== Titre ==== -->
<content:declareField name='title' title='title'
type='SmallText'/>
<content:textField name='title' defaultValue='' id='title'/>
<jahiaHtml:actionMenu name='title' namePostFix=''
resourceBundle='jahiatemplates.Corporate_portal_templates' useFieldSet=''>
</jahiaHtml:actionMenu>
</p>
<p>
<!-- ==== Description ==== -->
<content:declareField name='description' title='description'
type='BigText'/>
<content:bigTextField name='description' defaultValue=''
id='description'/>
<jahiaHtml:actionMenu name='description' namePostFix=''
resourceBundle='jahiatemplates.Corporate_portal_templates' useFieldSet=''>
</jahiaHtml:actionMenu>
</p>
That what i've done. if someone has a solution using only the tags, i'm
interessed !!
Regards,
Guillaume.
Christopher Kelley wrote:
>I am trying to set up a links portlet that displays content from the new
>pages it creates.
>
>For example,
>
>I click to add a new "link" and select a new page using a specific template.
>Now, I don't want to have to enter things twice. So, I want to set up the
>links list to display the title, and other key information from the pages
>created in the links portlet within the link's displayed information in the
>portlet. Thus, when I update the description field on the created page, the
>update is also displayed in the description field of the applicable link in
>the links portlet.
>
>
>How do I do this? I set up the new template I want to use for the new
>pages, but I am stuck on how to set up a new portlet -- or even if this is
>the route for me to take at all here.
>
>Thoughts and help appreciated!
>
>
>
--
------------------------------------------------------------------------
*Guillaume Kuhmel*
*Ingénieur Concepteur Développeur*
*[email protected] <mailto:[email protected]>*
*Tél. : +33 (0)6.88.33.36.16*
*http://www.sqli.com* <http://www.sqli.fr>
*Groupe SQLI**
**75 rue Marcelin Berthelot
13848 Aix en Provence Cedex 3*