Hi, how can I echo something and if its very long lets say 200 words it will put dots at the end of the 200 words article and display a keep reading link to another page like I'm not sure if you guys know what I mean Thanks in advance for any help
hi, there are many ways to do this.. if you want just echo substr('abcdef', 0, 3); // abc or you can use pagination.
Hi, thanks but but how can I do this.. $article = $_POST["article"]; $article_sub = substr($article, 0 , 200); if ($article_sub) {echo $article . '...Continue reading';} else {echo $article;} PHP: So if $article_sub == true, if its has more than 200 words on it, I want to echo at the end of the article ... Continue reading. else if the article doesn't have 200 then just echo the $article?
You can use strlen() to check the length of the article like if(strlen($article) > 200){ echo substr($article, 0, 200).'... continue reading'; } else{ echo $article; } PHP: