Display shorten title sentence

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 15, 2014   (RSS)

By claire - July 15, 2014

Try this:

echo substr($title, 0, 50) . '...';

This will show the first 50 characters of the title and then add a ... to the end of it.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By esupport - July 15, 2014

Hi claire

Where to add it?

I tried 

<?php echo substr($title, 0, 50) . '...'; ?>

and

<?php echo htmlencode($title, 0, 50) . '...'; ?>

got error "Undefined variable"

-Jax H.

By claire - July 15, 2014

You need to change $title to the right variable name - whatever you're using in your code to display this header.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/