Welcome Guest, Not a member yet? Register   Sign In
Parsing Blog Posts for first <p> and <img> elements
#1

[eluser]waynhall[/eluser]
I'm trying to create a view that displays a thumbnail image and first paragraph of each post in a foreach loop.

I tried using simplexml and xpath to parse the document, but I think that's a little overkill, since I just want to grab the first and ignore the rest. There are also some character encoding issues when echoing out the text.

I tried using substr and strpos to parse the elements, which works, but the code is kind of ugly.

I don't want to use regex.

Anybody know of a simple way to do this in CodeIgniter?


Messages In This Thread
Parsing Blog Posts for first <p> and <img> elements - by El Forum - 07-29-2011, 10:40 PM
Parsing Blog Posts for first <p> and <img> elements - by El Forum - 07-30-2011, 04:53 AM
Parsing Blog Posts for first <p> and <img> elements - by El Forum - 07-30-2011, 08:56 AM
Parsing Blog Posts for first <p> and <img> elements - by El Forum - 07-30-2011, 09:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB