Page 1 of 1

Please help!!

Posted: Mon Mar 30, 2009 5:26 am
by edmore
I have this code in a template that I am customising

Code: Select all

<?php
   $lstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   for( $i = 0; $i < strlen($lstr); $i++ ) {
   $l = substr( $lstr, $i, 1);
   echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'alpha=' . $l ) . '"><u>' . $l . '</u></a>&nbsp;&nbsp;';
}
?>
As it is, it outputs right across the page. What I really want is to separate the letters on different lines like this:

ABCDE on line 1
FGHIJ on line 2
KLMNO on line 3
PQRSTU on line 4
VWXYZ on line 5

How do I do this

Many Thanks

Eddie

Re: Please help!!

Posted: Mon Mar 30, 2009 5:32 am
by php_east

Code: Select all

   
$word_length=4;
for( $i = 0; $i < strlen($lstr); $i=$i+$word_length ) {
   $l = substr( $lstr, $i, $word_length);
 
and add a <br after your link.