leonidas Posted September 7, 2013 Share Posted September 7, 2013 hello! i run a mybb forum and they have the worst support forum so i decided to try my luck here... i have this plugin code and what i want is when the line reachers 30 characters it will go to the next line... here's the code --> $post['custom_status_shortened'] = (strlen($post['custom_status']) > 13) ? substr($post['custom_status'],0,30): $post['custom_status']; thanks in advance to those who can help me... Quote Link to comment Share on other sites More sharing options...
Irate Posted September 7, 2013 Share Posted September 7, 2013 If you have a string containing more than 30 utf characters (you might want to be careful with character counting for special entities, such as the exponential e which's unicode representation consists of two sequences rather than one, which ultimately affects strlen), you can create a copy of the remaining string using substr, then append \n to the string (eventually \r\n for email bodies or whatever), and then concatenate the strings again. Just an idea. Quote Link to comment Share on other sites More sharing options...
leonidas Posted September 8, 2013 Author Share Posted September 8, 2013 If you have a string containing more than 30 utf characters (you might want to be careful with character counting for special entities, such as the exponential e which's unicode representation consists of two sequences rather than one, which ultimately affects strlen), you can create a copy of the remaining string using substr, then append \n to the string (eventually \r\n for email bodies or whatever), and then concatenate the strings again. Just an idea. hi! thanks for the reply... that's the problem, i don't know anything about coding... i just run a forum, hopefully somebody can help me here... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.