TR: TR: [opencms-dev] how to include a link content ??

M Butcher mbutcher at grcomputing.net
Fri Aug 1 18:51:01 CEST 2003


Alright... I think I understand now. Here's one way to test for file
types. I'm not sure how to figure out what file a link is referencing. I
thought there was a method in CmsObject, but I don't see it now. If a
link is an XML file, you might have to use the com.opencms.templates.*
stuff to get it out... but again, I'm not sure, and I can't find any
links on my own system to do a quick test on.

Anyway, I hope this gets you a bit farther.


 CmsObject cmso = cms.getCmsObject() // Where cms is CmsJspActionElement
 com.opencms.flex.jsp.CmsJspNavElement rootNe
 com.opencms.file.CmsFile file;
 while (rootI.hasNext())
     {
     rootNe = (com.opencms.flex.jsp.CmsJspNavElement)rootI.next();
        file = cmso.readFile(rootNe.getResourceName();
        //IF(rootNe is a page)
        if(cmso.getResourceType("page").getResourceType() 
          == file.getType())
                cms.include(rootNe.getResourceName());
        //ELSE
        // I think the name of a link is "link"
        else if (cmso.getResourceType("link").getResourceType() 
          == file.getType()) { 
                //this is a link to a page
                //myLinkedPage=getThePageFromTheLink(rootNe)
                String myLinkedPage = 
                cms.include(myLinkedPage);
        }
     }

On Fri, 2003-08-01 at 09:44, Apostoly Guillaume wrote:
> That would be nice, but I want to display only the files and links that the
> user wants to display => that's why i'm using getNavigation.
> What I would need is the pseudo code below :
> 
>  com.opencms.flex.jsp.CmsJspNavElement rootNe
>  while (rootI.hasNext())
>      {
>      rootNe = (com.opencms.flex.jsp.CmsJspNavElement)rootI.next();
> 
> 	IF(rootNe is a page)
> 		cms.include(rootNe.getResourceName());
> 	ELSE 
> 		this is a link to a page
> 		myLinkedPage=getThePageFromTheLink(rootNe)
> 		cms.include(myLinkedPage);
>      }
> 
> Any idea ?
> 
> -----Message d'origine-----
> De: M Butcher [mailto:mbutcher at grcomputing.net] 
> Date: vendredi 1 août 2003 18:02
> À: opencms-dev at opencms.org
> Objet: Re: TR: [opencms-dev] how to include a link content ??
> 
> 
> What about using something like 
> 
> CmsJspActionElement cms = 
>   new CmsJspActionElement(pageContext, request, response);
> String foldername = "/myfolder/";
> Iterator i = cms.getCmsObject().getFilesInFolder(foldername).iterator();
> 
> That should give you a list of all of the files in a folder, including
> (I believe) links.
> 
> Matt
> 
> On Fri, 2003-08-01 at 03:10, Apostoly Guillaume wrote:
> > Hi all,
> > 
> > I'm reposting this question because I had no answer and i'm sure there's
> an
> > easy solution to it.
> > Thanks by advance, for your help.
> > 
> > Guillaume.
> > 
> > Objet: [opencms-dev] how to include a link content ??
> > 
> > 
> > Hi all,
> >  
> > I've developed a peace of JSP that display all documents (to be shown in
> > navigation from a directory) by using cms.include.
> > This is basically the code.
> >  
> > com.opencms.flex.jsp.CmsJspNavElement rootNe
> > while (rootI.hasNext())
> >     {
> >     rootNe = (com.opencms.flex.jsp.CmsJspNavElement)rootI.next();
> >     cms.include(rootNe.getResourceName());
> >     }
> > 
> > This works, but if i put in my folder a link to another document, instead
> of
> > a page, this doesn't work anymore.
> > So how can I : 
> > - test if the current "rootNe" is a link or a page ?
> > - gain access to the linked page to include it ?
> >  
> > Thanks by advance for your help,
> >  
> > Regards,
> >  
> > Guillaume.
> >  
> > _______________________________________
> > Guillaume APOSTOLY 
> > Business-Analyst EIS-BSD 
> > Tél: +33 (0)1.30.44.95.22 
> > Fax: +33 (0)1.30.44.98.08 
> > ApostolyG at mail.europcar.com <mailto:ApostolyG at mail.europcar.com>  
> > _______________________________________ 
> > 
> > 
> > 
> > 
> > 
> > 
> >  
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, please visit
> > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, please visit
> > http://mail.opencms.org/mailman/listinfo/opencms-dev
-- 
M Butcher <mbutcher at grcomputing.net>



More information about the opencms-dev mailing list