i have a paragraph in the database its like
$str =”this is a paragraph i show shortly and when i click on the view more it will show completely for that i am using the ajax and retrieve it “
i show this like
this is a paragraph i show shortly
php for show the first some word is
function chop_string($str, $x)// i called the function
{
$string = strip_tags(stripslashes($string));
return substr($string, 0, strpos(wordwrap($string, $x), "\n"));
}
and when user click on the view more it will display rest of it but the problem it that how to skip this this is a paragraph i show shortly and show the rest of it
i want to show the paragraph after the $x on click on view more
I have made an example here: shaquin.tk/experiments/showmore.html.
You can view the source to see all of the code behind it. The PHP code is displayed on the page.
If you don’t want to display the start string when
Show moreis clicked, replace the JavaScript functionshowMorewith this:Hope this helps.