scvinodkumar Posted March 9, 2009 Share Posted March 9, 2009 hi there, i want to display a html content but with limited words. for example, <p><span class="blog_post_source">http://news.google.co.in/news/url?sa=T&ct=in/2-0&fd=R&url=http://www.timesonline.co.uk/tol/sport/cricket/article5865371.ece&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNFBuJoZJmnl_23NLQw1Wltr7eC_yA</span></p> <table border="0" cellspacing="7" cellpadding="2"><tbody><tr><td width="80" align="center" valign="top"><font style="font-size: 85%; font-family: arial,sans-serif"><a href="http://news.google.co.in/news/url?sa=T&ct=in/2i-0&fd=R&url=http://news.bbc.co.uk/go/click/rss/1.0/-/sport2/hi/cricket/7927829.stm&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNHN47gltqDgLhSLKZT2IBciYIlGiA"><img src="http://nt1.ggpht.com/news?imgefp=pWmRFr9uA94J&imgurl=newsimg.bbc.co.uk/media/images/45530000/jpg/_45530485_63c45599-68f0-4a2a-8ab1-0758926e386d.jpg" border="1" width="80" height="60" /><br /><font size="-2">BBCSerbian.com</font></a></font></td><td class="j" valign="top"><font style="font-size: 85%; font-family: arial,sans-serif"><br /><div style="padding-top: 0.8em"><img border="0" width="1" height="1" /></div><div class="lh"><a href="http://news.google.co.in/news/url?sa=T&ct=in/2-0&fd=R&url=http://www.timesonline.co.uk/tol/sport/cricket/article5865371.ece&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNFBuJoZJmnl_23NLQw1Wltr7eC_yA"><strong>Pietersen voices IPL fears after Lahore attack</strong></a><br /><font size="-1"><strong><font color="#6f6f6f">Times Online</font></strong></font><br /><font size="-1">KEVIN PIETERSEN, the most expensive player at last month’s Indian Premier League auction, is considering withdrawing from the lucrative Twenty20 tournament, due to start next month, because of the terrorist attack on the Sri Lankan side in Lahore last <strong>...</strong></font><br /><font size="-1"><a href="http://news.google.co.in/news/url?sa=T&ct=in/2-1&fd=R&url=http://www.google.com/hostednews/ukpress/article/ALeqM5hmi77V0j37PT5xhJ60JgEJLJgEMA&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNEf00wqmvQkOqvvlTJpxkmWE6-2Jg">Pietersen admits IPL doubts</a> <font size="-1" color="#6f6f6f">The Press Association</font></font><br /><font size="-1"><a href="http://news.google.co.in/news/url?sa=T&ct=in/2-2&fd=R&url=http://ipl.timesofindia.indiatimes.com/IPL_opener_likely_at_Brabourne_/articleshow/4238731.cms&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNHzx9jjQkNd-HMPqvdBmWykuNxWig">IPL opener likely at Brabourne</a> <font size="-1" color="#6f6f6f">Indiatimes</font></font><br /><font size="-1"><a href="http://news.google.co.in/news/url?sa=T&ct=in/2-3&fd=R&url=http://timesofindia.indiatimes.com/Cities/Strict-demands-puts-IPL-matches-in-jeopardy/articleshow/4236696.cms&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNHdAi5S_DD9DovCPK_3IObZoBEKJw">Times of India</a> - <a href="http://news.google.co.in/news/url?sa=T&ct=in/2-4&fd=R&url=http://www.telegraphindia.com/1090307/jsp/frontpage/story_10638594.jsp&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNEftfcApY1l8qhcfRVmUFAVnqK2eA">Calcutta Telegraph</a> - <a href="http://news.google.co.in/news/url?sa=T&ct=in/2-5&fd=R&url=http://www.hindu.com/2009/03/07/stories/2009030757330100.htm&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNH008XQFUpGgZ3FPHhNJH_6a2pGiw">Hindu</a> - <a href="http://news.google.co.in/news/url?sa=T&ct=in/2-6&fd=R&url=http://cricketnext.in.com/news/modi-saves-ipl-with-new-schedule-venues/38871-13.html&cid=1311390199&ei=AB6zSeSYFOLemQfonszxBQ&usg=AFQjCNFNboeh9Bmg2Mz7SwLsGvpfWFxoZg">Cricketnext.com</a></font><font size="-1"><a href="http://news.google.co.in/news?pz=1&ned=in&hl=en&ncl=1311390199"><strong>all 703 news articles</strong></a></font></div></font></td></tr></tbody></table> without breaking the structure how to limit the words Quote Link to comment https://forums.phpfreaks.com/topic/148567-limit-words/ Share on other sites More sharing options...
scvinodkumar Posted March 9, 2009 Author Share Posted March 9, 2009 when i use substr, some of the closing tags are removed so what happens the entrire structure is collapse. how do i close/balance those tags that are opened? please help me.... Quote Link to comment https://forums.phpfreaks.com/topic/148567-limit-words/#findComment-780152 Share on other sites More sharing options...
Adam Posted March 9, 2009 Share Posted March 9, 2009 Bit difficult seen as you have so many tags in there. You could strip the tags out using "strip_tags()", but you're going to be left with that giant URL at the start. Will every output have one, or is it just this one? "preg_replace()" is an option to filter out any bits you don't want! Adam Quote Link to comment https://forums.phpfreaks.com/topic/148567-limit-words/#findComment-780157 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.