Topic: Setting CSS with PHP Question

I am wondering of someone could offer an assistance with this problem I am trying to resolve.  I have a left column navigation system that is generated based on if a user is logged in and the level of access the user has.  I have created 3 navigation boxes that "stack" on top of each other.  All of the boxes are wrapped in a div.  The boxes have a header with a background color and the box has a 1 px solid border.  the navigation is generated buy using a unordered list with list-style-type set to none.  I set background colors for each list item for link and hover, etc.  I also have a top border on each list item to create a button effect using css rather than JS and images.

Here is the problem.  I dont one the first item in each list to have a border so I was thinking a creating a special rule that would be applied only to the top list item in the navigation.  since the menu is generated differently for different usergroups, I need to dynamically apply this rule "class" using PHP.  Any thoughts on how I could do this?  Should I take the procedural approach, and count rows and then check for the 1st row and apply the css rule ?  Again I may be making this harder than it needs to be.

Thanks

2

Re: Setting CSS with PHP Question

Heres where IE falls flat. With Gecko/Opera it would be easy. Are you using a loop to generate the list items?. If so you can use a counter in the loop to identify the first item, thats the way PunBB does it.

Re: Setting CSS with PHP Question

Yes, I am running a loop to genterate the list items.  How did you overcome this with IE?

4

Re: Setting CSS with PHP Question

What I meant was that in Gecko/Opera you wouldn't need php at all, youl could just use css selectors. If you want to see how a class is assigned to the first item by a loop just look at viewtopic.php. The first post in each thread gets a class of .firstpost.

5 (edited by buzzkill 2005-02-11 20:50)

Re: Setting CSS with PHP Question

Paul wrote:

If you want to see how a class is assigned to the first item by a loop just look at viewtopic.php. The first post in each thread gets a class of .firstpost.

Is this the line you are talking about?  and should there be a letter p before the opening <?php right after <div id="

<div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo $vtbg ?><?php if (($post_count + $start_from) == 1) echo ' firstpost'; ?>">

Thanks for the help.  Sometimes just getting started is the hard part.

Re: Setting CSS with PHP Question

Nevermind.   got it now.  the p needs to be there.