MyBB Community Forums

Full Version: php question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how can I combine these two php codes:

wordwrap($text, 25, "<br />\n");

and

if(my_strlen($lastpost_subject) > 55)
{
$lastpost_subject = my_substr($lastpost_subject, 0, 55)."...";
}


I want the index latest thread titles to wordbreak at 25
if(my_strlen($lastpost_subject) > 55)
{
$lastpost_subject = my_substr($lastpost_subject, 0, 55)."...";
$lastpost_subject = wordwrap($lastpost_subject, 25, "<br />\n");
}
I would have loved for this to work but no dice. no line break
Try with this:
$lastpost_subject = wordwrap($lastpost_subject, 25, "<br />\n");
if(my_strlen($lastpost_subject) > 55)
{
    $lastpost_subject = my_substr($lastpost_subject, 0, 55)."...";
} 
(05-29-2017, 02:41 PM)chack1172 Wrote: [ -> ]Try with this:
$lastpost_subject = wordwrap($lastpost_subject, 25, "<br />\n");
if(my_strlen($lastpost_subject) > 55)
{
    $lastpost_subject = my_substr($lastpost_subject, 0, 55)."...";
} 

Hi, thanks for the tip,

no dice, it outputs the <br /> as plain text, so the only thing that shows up is this
TOP TITLE DESCRIPTION <BR /> FOR SITE


instead of this
TOPIC TITLE DESCRIPTION
FOR SITE
Because there is a code after this that parse html codes so you cannot use <br>
(05-29-2017, 03:25 PM)chack1172 Wrote: [ -> ]Because there is a code after this that parse html codes so you cannot use <br>

Hi thanks for responding, I appreciate it,
do you know how I can finish the titles with full words
like

THIS IS THE TITLE THAT...

instead of

THIS IS THE TIT....


I appreciate any help.
you can try adding below style rule at the bottom of global.css of the theme (add in advanced mode)
td {white-space: pre-wrap!important;}

for the precise suggestion,
I'd need your forum url to check the long title in live on your forum ..
(05-29-2017, 04:15 PM).m. Wrote: [ -> ]you can try adding below style rule at the bottom of global.css of the theme (add in advanced mode)
td {white-space: pre-wrap!important;}

for the precise suggestion,
I'd need your forum url to check the long title in live on your forum ..

That is all it was, simply white-space: pre-wrap!important;}

good job!