gametopius Posted April 11, 2009 Share Posted April 11, 2009 I am attempting to modify the rss.php file in my CMS. I would like it to display the first 250 characters of the stories description. But if the 250 is not empty I would like the character limit to increase until it finds the next open space. Here is a snipet of my code. Any help will be greatly appreciated and thank you for your time. if ($row->fulltext == "") $itemDesc = $row->introtext != "" ? $row->introtext : "No description"; else $itemDesc = $row->introtext . $row->fulltext; $length = 250 $desc_length_max = $length; $itemDesc = strip_tags($itemDesc, '<p> <br /> <br/> <br> <u> <i> <b> <img>'); $actualDescLength = strlen($itemDesc); parse_str (string $itemDesc [, array &$arr]) $itemDesc = substr($itemDesc, 0, $desc_length_max); $itemDesc = preg_replace("/\r\n|\n|\r/", "<br/>", $itemDesc); if ($arr[$desc_lenght_max] != " ") ($length + 1) ($itemDesc .= " [...]"); Else $length = 250; Link to comment https://forums.phpfreaks.com/topic/153662-rss-string-parse/ Share on other sites More sharing options...
RussellReal Posted April 11, 2009 Share Posted April 11, 2009 arr[$desc_lenght_max you spelled length wrong lol Link to comment https://forums.phpfreaks.com/topic/153662-rss-string-parse/#findComment-807594 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.