hello friends,
i have developed a php script which displays the news on the page. Even i have created the Read more link for the all those news. The problem is I want to display the whole sentence than the Read more links should appear.
Right now its showing up like..
Hi this is....[read more]
But i want the display like
Hi this is test. [read more].
The sentence should complete than the Read more link should come up. It should not be incomplete sentence than Read more link.
The coding is
Code: Select all
$length=strlen($row['newstext']);
if($length>250)
{
$posstr= strpos($row['newstext'],' ', 250);
echo ' <span class="event" id="news">'.substr($row['newstext'],0,$posstr).'
... <a href="../news.php?newsid='.$row['newsid'].'" class="read">[read more...]</a></span>';
}
else
{
echo ' <span class="event" id="news">'.$row['news_text'].'
</span>';
}
I hope you have understand my problem.
Thanks in advance
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: