Hey guyss. Well i have been working on a news system and i have pretty much alot of things done. But i still have 1 more thing left that I CANNOT figure out how to do because i never learned how to. This is what i need. For my news system i want it to show the news but not all of it. Just half of it and then it shows a link [Read Full Story]. This is the script that shows the news. $getarticles = mysql_query("select * from news where cat = '$cat' order by id desc limit 20"); while($articles = mysql_fetch_array($getarticles)) { $postdate = mysql_query("SELECT DATE_FORMAT(news.date, '%W, %M %d, %Y') as date FROM news where id = '$articles[id]'"); $row = mysql_fetch_array($postdate); $articles[text] = parse("$articles[text]"); echo("<h3 style=\"border-bottom: 2px dashed #315394;\">$articles[title]</h3><font face=\"Verdana\" size=\"1.8\">$articles[text]</font><br /> <div align=\"center\" style=\"margin-left: 15px; margin-right: 15px; margin-top: 4px; border-top: 1px dashed #939393;\">Posted on $row[date] by $articles[author]</div>"); PHP: If you would like to see the script in action here it is http://www.engineerpress.com/ep/ Thank You
Hey dude.... Just check out www.jokegoogle.com If you browse through, you would find that there are jokes that are large and get a "read more" link at the end. Here is the function that I use : ------------------------------------------- function nicetrim ($s, $id, $page) { $MAX_LENGTH = 1600; $str_to_count = html_entity_decode($s); if (strlen($str_to_count) <= $MAX_LENGTH) { return $s; } $s2 = substr($str_to_count, 0, $MAX_LENGTH - 3); $s2 .= "... "; $s2 .= "<a href = 'show_news.php?id=$id&origin=index&page=$page'>Read more</a>"; return $s2; } ----------------------------------------------- $id is the id of the joke, $s is the joke itself and $page is the page number. Let me know if you understand.