[opencms-dev] Looping over files

Paul-Inge Flakstad flakstad at npolar.no
Fri Mar 19 11:12:24 CET 2010


Hi Peter,

Ah, yes, my bad - I missed the fact that you were looping over multiple files in the <cms:contentload>. Not used to working with taglib code, hehe. :-)

Glad you figured it out, and of course, using <cms:link> like you've done here is also important.

Cheers,
Paul

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Petr Chelcický
> Sent: 19. mars 2010 11:04
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] Looping over files
> 
> 
> Hi Paul!
> 
> Thanks for the answer.
> 
> I'm not accessing it outside the loop. The inner loop just 
> goes through FaqFile subcategories. In the end I solved the 
> problem by changing the link into:
> 
> <a href="<cms:link><cms:contentshow 
> element="%(opencms.filename)" /></cms:link>">
> 
> I tried this a couple of times before and it didn't 
> work...Fortunately it works now:)
> 
> Thanks for your help, 
> Peter
> 
> ______________________________________________________________
> > Od: "Paul-Inge Flakstad" <flakstad at npolar.no>
> > Komu: The OpenCms mailing list <opencms-dev at opencms.org>
> > Datum: 19.03.2010 10:47
> > Předmět: Re: [opencms-dev] Looping over files
> >
> >Hi Petr
> >
> >You're reading the filename outside of your loops. If you're 
> trying to link to the FAQ files, you should probably place 
> some kind of <cms:contentshow "%(opencms.filename)" /> inside 
> the inner loop (where you have i++). You could of course also 
> just add the FAQ URLs to a list or something inside the loops.
> >
> >Also, I'm pretty certain you will have to use the syntax 
> like above, not just %(opencms.filename) on its own. I think 
> using it on its own will give you JSP, and using contentshow 
> will give you the HTML or whatever file is using the JSP.
> >
> >HTH :-)
> >
> >Best regards,
> >Paul
> >
> >> -----Original Message-----
> >> From: opencms-dev-bounces at opencms.org > 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Petr Chelcický
> >> Sent: 19. mars 2010 09:47
> >> To: The OpenCms mailing list
> >> Subject: Re: [opencms-dev] Looping over files
> >> > > I'm sorry but unfortunately my webmail client hid the 
> code, > so I'm sending it again:
> >> > Hi!
> >>  >  I'm developing a website using OpenCMS and am having a 
> > problem with creating links to files over which I loop 
> using > cms:contentload:
> >>  > >   <cms:contentload collector="allInFolder" > 
> param="ePass/faqs/|FaqFile" editable="false">
> >>     <%-- create a date object from date value --%>
> >>       <% int i = 0; %>
> >>       >       <cms:contentcheck ifexists="Subcategories"> 
> >       <cms:contentloop element="Subcategories"> >          
> <cms:contentloop element="Faqs">
> >>           <% i++; %>
> >>          </cms:contentloop>
> >>       </cms:contentloop> >      </cms:contentcheck> >      
> <b><a href="${opencms.filename}"><cms:contentshow > 
> element="Title" /></a></b> (<%= i %> answers) <br />
> >>   </cms:contentload> >  >  This is part of the index.jsp 
> file. All the links > unfortunately lead to index.jsp and not 
> to the individual FAQ > files. Do you know how to change this?
> >>  >  Thanks,
> >>  Peter
> >> > _______________________________________________
> >> This mail is sent to you from the opencms-dev mailing list
> >> To change your list options, or to unsubscribe from the 
> list, > please visit
> >> http://lists.opencms.org/mailman/listinfo/opencms-dev
> >> 
> >_______________________________________________
> >This mail is sent to you from the opencms-dev mailing list
> >To change your list options, or to unsubscribe from the 
> list, please visit
> >http://lists.opencms.org/mailman/listinfo/opencms-dev
> >
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev


More information about the opencms-dev mailing list