PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[syntax="xml"]<SearchUrls>
<Url query="05-06 Finest Shaquille O'Neal" type="Keyword">
<![CDATA[ http://www.qksrv.net/click-2039783-1037 ... ONeal_W0QQ
]]>
</Url>
<Url query="05-06 Finest Shaquille O'Neal" type="Keyword">
<![CDATA[ http://www.qksrv.net/click-2039783-1037 ... ONeal_W0QQ
]]>
</Url>
<Url query="05-06 Finest Shaquille O'Neal" type="Keyword">
<![CDATA[ http://www.qksrv.net/click-2039783-1037 ... ONeal_W0QQ
]]>
</Url>
</SearchUrls>
I have the xml feed above. I want to make links like this <a href="http://www.qksrv.net/click-2039783-1037 ... 0QQ">05-06 Finest Shaquille O'Neal</a> One for every URL in the xml. Can someone create the code I need to do this? I assume preg_match is going to be used, but I am not so great at it.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
If you're running PHP 5, DOM or SimpleXML are the extensions to use. They are worth learning instead of implementing a quick hack in regexps.
You can also use XSLT (PHP 4) or XSL (PHP 5) for transforming XML into HTML. Also worth learning.
Of course, if you want to do it regexps, research PCRE regular expressions
. The regexp for this actually isn't that difficult. But I recommend learning the XML extensions.