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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.