-3

Pls I am working on a website, an email website, but when I displayed the message from the database, how can I echo out only the first 26 characters from database and also add read more so that if the read more is clicked. It will display the full text

2 Answers2

0

You can use sbstr() function:

if (strlen($result) > 26)
    echo substr($result, 0, 26) . '...';
T. AKROUT
  • 1,719
  • 8
  • 18
0

two steps: 1.decide the length of the content using the substr() function, cut it off if it's more than the designated length and append an "......" behind while hiding the rest content,otherwise, display the whole content. 2.when click on the "read more",display the hidden part of the content

Jarvis
  • 1
  • 1