Jump to content

[SOLVED] add colour to numbers


the-botman

Recommended Posts

ok hi guys

 

I have this code now what it does is splits the text doc into different pages with 8 lines per page now i want to make the numbers and <>#* be shown in red with the code i have tried it works but just for numbers and only for the first page how do i make it work on all the pages and make the text size 2, here is my code.

<?php
        $ShowBookmark = "False";
        include 'Include/Header.php';

if(!isset($_GET['page'])){
   $page=0;
} else {
   $page=$_GET['page'];
}

$numsent=8; //number of sentences per page

$lines = file('phone-codes/sony-erricson.txt');
$startnum=$page*$numsent;
$endnum=$startnum+$numsent;
$numpartsinstring=count($lines); //counts number of lines in string

for($i=0;$i<$startnum;$i++){
   unset($lines [$i]); //kills parts before
}

for($j=$endnum;$j<$numpartsinstring;$j++){
  unset($lines [$j]); // kill parts after
}

$newstring=implode($lines,'<br>');
$i=0; 
$upper = 60;

while ($i <= $upper) {
    $newstring = str_replace($i, '<font face="Verdana" color="red">' . $i . '</font>', $newstring);
    $i++;
}
    $newstring = str_replace('#', '<font face="Verdana" color="red">#</font>', $newstring);
    $newstring = str_replace('-', '<font face="Verdana" color="red">-</font>', $newstring);
    $newstring = str_replace('*', '<font face="Verdana" color="red">*</font>', $newstring);

print '         <div class="hd2"><center><font color=#666666><strong>Nokia Secret codes</strong></font></center></div><br>'."\n";
print "$newstring";
print "<br><br>";
$numpages=ceil($numpartsinstring/$numsent);

for($i=1;$i<=$numpages;$i++){
  $actualstart=$i-1;
  if($actualstart!=$page)  {
    print "<A href='Sony-erricson.php?page=$actualstart'>$i</a> ";
  }  else  {
     print "$i ";
  }
}
?>

        <center><font face="Verdana" size="2"><?php echo $GLOBALS["Advert03"]; ?></font></center>
        <table id="" border="0" style="font-size:9pt;width:100%;">
                <tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/Logos/Logo_Back.gif"></td><td>
                        <font face="Verdana" size="2"><b><a href="secret-codes.php">Back</b></font></a><br>
                </td></tr>
        </table>
        <hr>
<?php
include 'Include/Footer.php'; 
Log_Hit("secret-codes"); 
?>

Thanks in advance

Zainul

Link to comment
https://forums.phpfreaks.com/topic/181884-solved-add-colour-to-numbers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.