dean91 Posted September 4, 2011 Share Posted September 4, 2011 Okay so I am trying to built a little script that displays buttons on a page but when more buttons are added they carry on across the page. I need them to linebreak after say 5 buttons but nothing seems to work this is the code $url = ($settings['clean'] == 0) ? $url : 'go.php?url='.rawurlencode($url); $nofollow = $settings['use_nofollow'] ? 'rel="nofollow"' : ''; $newurl = wordwrap($url, 20, "<br />\n"); echo ' <td class="showtag"><a href="'.$newurl.'" target="_blank" class="large blue button" '.$nofollow.'>'.$title.'</a>'.$show_url.'<br>'.'</td> Quote Link to comment https://forums.phpfreaks.com/topic/246434-wordwrap-problem/ Share on other sites More sharing options...
dean91 Posted September 5, 2011 Author Share Posted September 5, 2011 I would love any help with this Quote Link to comment https://forums.phpfreaks.com/topic/246434-wordwrap-problem/#findComment-1265625 Share on other sites More sharing options...
JKG Posted September 5, 2011 Share Posted September 5, 2011 can you try to explain better? sorry, i dont follow... Quote Link to comment https://forums.phpfreaks.com/topic/246434-wordwrap-problem/#findComment-1265681 Share on other sites More sharing options...
dean91 Posted September 5, 2011 Author Share Posted September 5, 2011 The buttons are echoed but they carry on across the page when if the page was static HTML I would add a </ br> tag after like 5-6 buttons so it does not break the page. This is how it is (It breaks the page): button button button button button button button button button button I need it like this: button button button button button </ br> button button button button button </ br> I need to find a way of adding a </ br> after every 5 buttons so the page displays correctly. Quote Link to comment https://forums.phpfreaks.com/topic/246434-wordwrap-problem/#findComment-1265694 Share on other sites More sharing options...
JKG Posted September 5, 2011 Share Posted September 5, 2011 use a for statement, on a multiple of 5? http://stackoverflow.com/questions/1500675/for-loop-do-action-every-5-results Quote Link to comment https://forums.phpfreaks.com/topic/246434-wordwrap-problem/#findComment-1265695 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.