|
Posted by rf on 08/21/07 08:29
"dorayme" <doraymeRidThis@optusnet.com.au> wrote in message
news:doraymeRidThis-4F2D6C.18120421082007@news-vip.optusnet.com.au...
>I will be soon making up a page with a table of items. There will
> be a fair few rows. All not high, all tabular.
>
> People will be referencing parts of it via links that latch onto
> ids that will be placed on the <tr>s. But while this will narrow
> things down for folk, they will still see a whole lot of other
> stuff depending on the vertical size of their browser window. I
> was rather hoping there might be a neat way of also highlighting
> the row concerned, not necessarily literally the row, but
> something to mark it out as the one to be attended to. Need no
> help with the actual css, more with how to let the browser or
> server know which row needs the style.
>
> Can't think of any normal html/css way of doing this. Not
> particularly keen on a js way ...though I might consider it as it
> is sort of an extra bit of help and not fundamentally bad if
> anyone has it turned off.
>
> Anyone know of a php way perhaps? Do I have to go to alt.php. or
> alt.js.
>
> Can't I please just stay here? I like it here in spite of my bad
> treatment.
>
> I am reminded of that php stuff that I have used to stick in an
> id="current" on some list items depending on the html file being
> accessed. Perhaps it will all be clear by morning. But if anyone
> knows the way to go without blinding me with science... please,
> do spill the beans. <g>
I do something similar in a CMS. There is a table of, say, pages. One of
those pages will be the current one being actioned (deleted, renamed, edited
or whatever).
// $arr is an array of rows from the database.
// $current is the index into this array of the page being actioned.
for ($i = 0;$i < count($arr);$i++)
{
echo '<tr';
if ($i == $current)
{
echo " class='current'";
}
// optional if you want rows coloured alternatively. Easier to read.
else if ($i % 2)
{
echo "class='odd'";
}
echo ">\r\n";
// echo a <td> for each field in the row
echo "</tr>\r\n";
}
Flavour 'current' and 'odd' to taste, probably using background colour.
--
Richard.
Navigation:
[Reply to this message]
|