[opencms-dev] how to access title all pages in a folder
Pavel Peringer
pavel.peringer at qbizm.cz
Tue Aug 29 09:48:26 CEST 2006
Sorry to all, but cut&paste from JavaDoc was not really good idea..
This should be more readable.
> Code snipet for OpenCms 6.2.X
>
> 1) use resource list
>
> CmsJspActionElement cmsJsp = new CmsJspActionElement(pageContext,
> request, response);
> CmsObject = cmsJsp.getCmsObject();
> List resources =
> cmcObject.getResourcesInFolder("/sites/default/modulesdemo/modules/faq/",
> CmsResourceFilter.DEFAULT);
> Iterator it = resources.iterator();
> while (it.hasNext())
> {
> CmsResource resource = (CmsResource) it.next();
> String title = cmsObject.readPropertyObject(resource,
> CmsPropertyDefinition.PROPERTY_TITLE>, false);
>
> [show code here]
> }
>
> 2) use navigation list (requested resources must be in navigation)
>
> CmsJspActionElement cmsJsp = new CmsJspActionElement(pageContext,
> request, response);
> CmsNavBuilder cmsNavigation = cmsJsp.getNavigation();
> List resources =
> cmsNavigation.getNavigationForFolder("/sites/default/modulesdemo/modules/faq/");
> Iterator it = resources.iterator();
> while (it.hasNext())
> {
> CmsJspNavElement element = (CmsJspNavElement) it.next();
> String title = element.getTitle();
>
> [show code here]
> }
>
> I prefer the second method because you can set position (NavPos
> property) of every resource and make custom order.
>
> HTH
>
> Pavel Peringer
>
>> Hi All,
>>
>> I want to render the title of all pages existing in folder
>> *“/sites/default/modulesdemo/modules/faq/” . *If I use
>> *getResourcesInFolder(String) *of *CmsObject* to access list of
>> resources , I don’t get “title” of resource from Object of resource .
>>
>> Can somebody plz tell me how to access the title of all pages
>> existing in folder *“/sites/default/modulesdemo/modules/faq/”.*
>>
>> Regards:
>>
>> Sarthak Mishra
>>
>> ------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> 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
>>
>
>
--
Pavel Peringer Qbizm technologies, a.s.
programator ... the art of software.
____________________________________________________________________
www.qbizm-technologies.cz www.qbizm.cz www.qbizm-services.cz
More information about the opencms-dev
mailing list