Jump to content

bgcolor of a table row cell with $page id


tbint

Recommended Posts

I use an array for page id. I have a menu.txt included for page links

 

<?php
<table>
<tr>
  <td $bg>
<a href='/'>Home</a> 
  </td>
</tr>

<tr>
  <td $bg>
<a href='?id=2'>About</a> 
  </td>
</tr>

<tr>
  <td $bg>
<a href='?id=3'>Contact</a> 
  </td>
</tr>

<tr>
  <td $bg>
4
  </td>
</tr>

<tr>
  <td $pg>
5
  </td>
</tr>
</table> 
?>

 

My attempt is to give background color to the link of the current page. Just by

echo('bgcolor="#C3D9FF"');

to the table cell threw a veritable or an array. Since I use an array to include a .txt file in a div for pages by $_get $id like this

 

<?php
$pages = array ( 
  1 => array('file' => 'pages/home.txt'),
  2 => array('file' => 'pages/about.txt'),
  3 => array('file' => 'pages/contact.txt'),
  4 => array('file' => 'pages/'),
  5 => array('file' => 'pages/'),
  6 => array('file' => 'pages/'),
  404 => array('file' => 'pages/404.txt')
   );

  if (isset ($_GET['id'])) {
    $pageID = $_GET['id'];
    if (! isset($pages[$pageID])) $pageID = 404;
  } else { 
    $pageID = 1;
  }

  include($pages[$pageID]['file']); 
?> 

 

I tried to adapt the array to the table row cell with no success.

 

Would a veritable be a better way of doing this? I have trouble with veritable since my index file is not php enabled. Just include tags. I may need to rewrite it.

here is the test site. No Title

 

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.