[opencms-dev] change images links

Mario Jäger m.jaeger at alkacon.com
Fri Apr 30 11:51:33 CEST 2010


Hi Gleb,

In the source code you posted you can use the CmsLink.getType() method to get the type 
of the link. With an additional if-clause you can filter for the type "img" then.

-- 
Kind Regards,
Mario.
 
-------------------
Mario Jäger
 
Alkacon Software GmbH  - The OpenCms Experts                    
http://www.alkacon.com - http://www.opencms.org


gleb makarov schrieb:
> Hello everyone,
>
> I have a problem. I need to change programmatically 'src' attribute 
> for images in xmlpage file type. Now all images have internal links 
> (internal="true" parameter) and I need to make them external by 
> changing value in <target> tag. Can somebody tell me the name of 
> function for this action?
>
> I`ve found only this method:
> <...>
> CmsXmlPage page = CmsXmlPageFactory.unmarshal(cmsObj,templateFile);
> CmsLinkTable table = page.getLinkTable("body",locale);
> for(Iterator i = table.iterator(); i.hasNext();){
>       CmsLink listElement = (CmsLink)i.next();
>       listElement.updateLink("http://somedomen.com"+listElement);
> }
> <...>
>
> But it changes all links for <link type="A">, but I need to change 
> links for <link type="IMG">.
>
> Thank you.
>
> -- 
> Best regards,
> Gleb Makarov
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> 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