Hey Coders,
Hopefully I can get some help. I have a page that asks a user to input content, but the issue I'm stuck on is how can I have PHP take the string, split it up into multiple variables length of which would be based on an output dimension.
So for example, I have a box that is 500x500 and I want php to take the user content and split it to fit multiple 500x500 boxes.
strlen and substr will not do what I need it to do as the content could have line breaks in it.
So right now I have
$page = substr($content, 0, strrpos(substr($content, 0, 675), ' '));
echo nl2br($page,false);
Which will split the content at the 675 character, but also keeping the word (instead of just splitting it).
That works for just the word/character count, but when the user starts to introduce line breaks, and paragraphing it won't fit properly into the widgets.
So instead of doing a word/character count is it possible to do a string split based on the output dimension size?
The widgets themselves will never change size but the content being placed into them will change when it comes to formatting.
So does anyone have any ideas on how I can accomplish this?