Forums / Templates, Stylesheets, Page Layout / ezpage header <li> css id

ezpage header <li> css id

Locked

Views: 2,828

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
27 Mar 2009, 4:09 PM
#1
idaho_jim avatar

idaho_jim

New Zenner

Join Date:
Dec 2008
Location:
idaho
Posts:
14
Plugin Contributions:
0

ezpage header <li> css id

I'm trying to modify my ezpage heaer bar to assign li ids that I can modify via css.

Dr Byte got me started here

in tpl_ezpages_bar_header.php

I think I should do this:

<li id="<?php echo $var_linksList[$i]['id']; ?>">
```but the <li> tags are outside the loop. I get an extra list item for each actual list item placing this inside the loop

<?php if (sizeof($var_linksList) >= 1) { ?> <div id="menu"> <ul id="nav"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { ?> <li id="<?php echo $var_linksList[$i]['id']; ?>"> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } // end FOR loop ?> </li> </ul> </div> <?php } ?> ``` any body have any ideas?
27 Mar 2009, 11:36 PM
#2
jwitt98 avatar

jwitt98

New Zenner

Join Date:
Feb 2009
Posts:
95
Plugin Contributions:
0

Re: ezpage header <li> css id

The closing </li> tag also needs to be inside the loop.

27 Mar 2009, 11:56 PM
#3
jwitt98 avatar

jwitt98

New Zenner

Join Date:
Feb 2009
Posts:
95
Plugin Contributions:
0

Re: ezpage header <li> css id

have you tried:

<?php if (sizeof($var_linksList) >= 1) { ?>
<div id="menu">
    <ul id="nav">
    <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
        <li id="<?php echo $var_linksList[$i]['id']; ?>">
        <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo '</li>';?><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?>
<?php } // end FOR loop ?>
</ul>
</div>
<?php } ?>
28 Mar 2009, 12:20 AM
#4
idaho_jim avatar

idaho_jim

New Zenner

Join Date:
Dec 2008
Location:
idaho
Posts:
14
Plugin Contributions:
0

Re: ezpage header <li> css id

It produces the excpected output, but with a special bonus empty <li>

<ul id="nav"><li id="20"></li><li>         </li><li id="3"></li><li>         </li><li id="2"></li><li>         </li><li id="15"></li><li>         </li><li id="16"></li><li>         </li><li id="17"></li><li>         </li><li id="18"></li><li>         </li><li id="19"></li><li>         </li><li id="21"></li></ul>
28 Mar 2009, 12:25 AM
#5
idaho_jim avatar

idaho_jim

New Zenner

Join Date:
Dec 2008
Location:
idaho
Posts:
14
Plugin Contributions:
0

Re: ezpage header <li> css id

jwitt98:

have you tried:

<?php if (sizeof($var_linksList) >= 1) { ?> <div id="menu"> <ul id="nav"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { ?> <li id="<?php echo $var_linksList[$i]['id']; ?>"> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo '</li>';?><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } // end FOR loop ?> </ul> </div> <?php } ?> ```

Perfect Thanks.

My extra list item was in the EZ Pages Settings in the Admin. :oops:

28 Mar 2009, 12:43 AM
#6
jwitt98 avatar

jwitt98

New Zenner

Join Date:
Feb 2009
Posts:
95
Plugin Contributions:
0

Re: ezpage header <li> css id

Strange.

I'm guessing it's either looping one too many times or you have a blank ezpage with no name assigned.
Look in your ezpages table and see if there is an entry with blank 'pages_title'

Edit: I apparently took too long to finish my post, glad you got it.