[opencms-dev] Setting navigation properties dynamically in xmlcontent?
Manfred Schenk
manfred.schenk at zerobyte.de
Mon Aug 15 21:11:20 CEST 2011
Hi,
My goal is to build a dynamic navigation for some xmlcontent.
Is there a "best-practice" how to do that or should I follow the ideas
mentioned in the (old) mail I added to this mail?
I'm currently using Version 7.5 but I'll switch to the newest version as
soon as I have enought spare time to do this.
Regards,
Manfred
Am 07.08.2006 18:49, schrieb Roman Uhlig:
(Re: [opencms-dev] modifing properties of resources returned by contentload)
> Hi Eric!
>
> Yes, this is possible by using CmsJspXmlContentBean.contentload, introduced
> with Opencms 6.2.
>
> This way we implemented a comfortable way of sorting XMLcontent by priority
> for our editors:
> http://www.idaba.de/tmp/opencms_prioritysort.jpg
>
> Here's a code snippet for illustrating the important parts. It's setting a
> new priority for a set of XMLcontent objects and it's siblings (i.e.
> multilanguage site):
>
> // initializing the XmlContentBean
> CmsJspXmlContentBean jcb = new CmsJspXmlContentBean(pageContext, request,
> response);
>
> // setting the collector type and initializing a ContentContainer
> String collectorName = new String("allInFolderPriorityDateDesc");
> I_CmsXmlContentContainer a_contentContainer = jcb.contentload(collectorName,
> collectorParameter, new java.util.Locale(arr_used_languages[lang_count]),
> false);
>
> // getting the collector results
> List contentList = a_contentContainer.getCollectorResult();
>
> // iterating the results and getting/setting properties
> while(a_contentContainer.hasMoreContent()){
> CmsObject cmsObj = jcb.getCmsObject();
> cmsObj.lockResource(a_contentContainer.getResourceName());
>
> Map properties =
> cmsObj.readProperties(a_contentContainer.getResourceName());
>
> // setting a new priority
> properties.put(new String("collector.priority"), String.valueOf(20));
>
> cmsObj.writeProperties(a_contentContainer.getResourceName(), properties);
> cmsObj.unlockResource(a_contentContainer.getResourceName());
> }
>
>
> I hope this helps a bit.
>
> Best regards,
> Roman
--
| Manfred Schenk | born between RFC638 and RFC640
| PGP-Keys unter |
| http://www.ZEROByte.de/pgp/ | WWW: http://www.ZEROByte.de/
More information about the opencms-dev
mailing list