fazzfarrell Posted October 14, 2007 Share Posted October 14, 2007 I have this: <div class="AccordionPanelTab"><?php echo chop($row_rsNewsItems['Title']); ?></div> and I want to trim the length of the title so it is only 100 chareters wide, where do I start? Quote Link to comment https://forums.phpfreaks.com/topic/73207-solved-trim-by-lenghth/ Share on other sites More sharing options...
GingerRobot Posted October 14, 2007 Share Posted October 14, 2007 Try the substr() function. Quote Link to comment https://forums.phpfreaks.com/topic/73207-solved-trim-by-lenghth/#findComment-369295 Share on other sites More sharing options...
fazzfarrell Posted October 14, 2007 Author Share Posted October 14, 2007 i tried this thanks <div class="AccordionPanelTab"><?php echo substr('$row_rsNewsItems['Title']', 1); ?></div> and I get an error Parse error: syntax error, unexpected T_STRING? Quote Link to comment https://forums.phpfreaks.com/topic/73207-solved-trim-by-lenghth/#findComment-369297 Share on other sites More sharing options...
trq Posted October 14, 2007 Share Posted October 14, 2007 <div class="AccordionPanelTab"><?php echo substr($row_rsNewsItems['Title'],0, 100); ?></div> Quote Link to comment https://forums.phpfreaks.com/topic/73207-solved-trim-by-lenghth/#findComment-369302 Share on other sites More sharing options...
fazzfarrell Posted October 14, 2007 Author Share Posted October 14, 2007 got it thanks, got it perfect by doing this <div class="AccordionPanelTab"><?php echo substr($row_rsNewsItems['Title'], 0, 34); ?>...</div> thanks Quote Link to comment https://forums.phpfreaks.com/topic/73207-solved-trim-by-lenghth/#findComment-369303 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.