|
I am thinking that the best solution would be to mimic the
included getTitle function -- just with fields other than the title (http://www.jahia.org/javadoc-dev/org/jahia/data/containers/JahiaContainerDefinition.html#getTitle(int))
I wonder if anyone has the code for accomplishing
this... Is there a "get()" function where a child field can be
specified?
For example, if we take a look at the original code from
what called box_files.jsp in the default templates (note that I am referring to
3.1 and not 4):
...
JahiaPage link = (JahiaPage)
myContainer.getField("link" + id).getObject();
if (link !=
null){
%> <tr bgcolor="<%=rowColor%>"> <td valign="top" width="10"><img src="" width="7" height="16" alt=""></td> <td valign="top"> <a class="box" <% if (link.getPageType() == 2){ %> target="_new" <% } %> href=""><%=link.getTitle()%></a> ...
If I were to, say, add (where "billNumber" is a custom
field added to the template used in the child/link page):
JahiaPage billNumber= (JahiaPage)
myContainer.getField("billNumber" +
id).getObject();
Assuming that the above code line is even valid (I am unsure w/o testing it), how would I call it? I suppose by
<%=link.getbillNumber()%> , except getbillNumber() is yet undefined.
In any case, you'd think that this is a simple problem
to solve, so I am welcome to suggestions here, forgiving my awfully-rusty JSP
here.
Thoughts anyone?
From: Guillaume Kuhmel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 02, 2005 4:22 AM To: [email protected] Subject: Re: List Displaying Child Content 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 = ""> 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=''><%= 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! --
| ||||
<<bandeau-sqli.gif>>
