Jump to content

limit characters based on total number of characters .. ??


imarockstar

Recommended Posts

I am displaying data on my site. (duh) .. and I am limiting the character display to 200 characters.

I am using the below code :

 

<?= substr($text,0,200)  ?>

 

The above works great. My question is that what if the total number of characters to be displayed is less then 200, at that point I do not need to display a read more link. However if the total number of characters IS over 200 I need to display a (read more) link ..

 

anyone know the best way to do this ?

 

b

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.