[opencms-dev] Looping over files

Paul-Inge Flakstad flakstad at npolar.no
Fri Mar 19 10:45:08 CET 2010


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
> 


More information about the opencms-dev mailing list