RE: List Displaying Child Content

"Christopher Kelley" <[email protected]>
Newsgroups gmane.comp.cms.jahia.template
Organization New Hampshire Sierra Club
Message-ID <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAYeYYOP+7EUSt4LlzSRfFBsKAAAAQAAAAY2TKQnFnzUK2lLlPI61V/[email protected]>
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/JahiaContainerDe
finition.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="<%=theURL%>/images/triangle.gif"
width="7" height="16" alt=""></td>
    <td valign="top"> <a class="box" 
                <%
                if (link.getPageType() == 2){
                    %> target="_new" <%
                }
                %>
                href="<%=link.getUrl()%>"><%=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


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]
Tél. : +33 (0)6.88.33.36.16


 <http://www.sqli.fr> http://www.sqli.com
Groupe SQLI
75 rue Marcelin Berthelot 
13848 Aix en Provence Cedex 3
bandeau-sqli.gif (image/gif, 4.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.