public static function get_ps_from_str($str) { $ps = array(); $strs = Strings_Splitter::blank_line_separated($str); #print_r($strs); exit; foreach ($strs as $p_str) { $ps[] = new HTMLTags_P($p_str); } return $ps; }
public static function render_news_item($news_item_id) { $dbh = DB::m(); $query = <<<SQL SELECT \t* FROM \thpi_news_items WHERE \tid = {$news_item_id} SQL; $result = mysql_query($query, $dbh); if (mysql_num_rows($result) == 0) { throw new Exception('No news item found!'); } else { $news_item = mysql_fetch_assoc($result); /* * The title, */ echo '<h3>'; echo $news_item['title']; echo " \n"; echo date('d/m/y', strtotime($news_item['submitted'])); echo "</h3>\n"; /* * The first paragraph. */ $item = $news_item['item']; $item = stripslashes($item); $paragraphs = Strings_Splitter::blank_line_separated($item); foreach ($paragraphs as $p) { echo "<p>{$p}</p>\n"; } } }