Programatically fetch links/images with PHP

Author Message

Felix Laate

Friday 20 January 2006 12:55:05 am

Hi all,

In an extension I'm developing I need to fetch URL's and relplace the links in the XML-output generated by the online editor:

<linktarget="_self"url_id="9">Very boring link</link>

needs to get into:

<a href="http://my.link.com">Very boring link</a>

How can I programatically do this (with PHP)?

And then I need to do the same for images..

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Bård Farstad

Friday 20 January 2006 1:33:33 am

Hi Felix,

not sure which parts you are looking for. Assuming that you already know how to parse the XML you have you can fetch the URL by id (if it's eZ publish URL's you have) like this:

       $href = eZURL::url( $linkID );

Then you can just print the href and the text to make up the URL.

--bård

Documentation: http://ez.no/doc

Felix Laate

Friday 20 January 2006 3:46:31 am

Hi Bård,

Thnak you for your answer!

This is what I need. Only problem is the I get the error <i>Undefined class name 'ezurl' </i> when I try to use it. I guess it has something to do with initiating.. a topic I don't know to much about..

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Felix Laate

Friday 20 January 2006 3:59:37 am

Hi again,

Got it! Just put:

include_once( "kernel/classes/ezurltype.php" );

at the top of my file.

Thanks for helping!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Felix Laate

Friday 20 January 2006 4:51:43 am

Me again..

Now I need the title and target of the link.. is there any good way to get a grab on these?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.