Alternating a menu system...
Hi there I am trying to alternate some HTML code (together with some PHP that will allow dynamic menu names and menu icons (so that I have a icon above the first menu name, then icon below the menu name...so on and so forth..
I found that I needed to use a PHP modulator to create this: The below example code shows the menu working how I want it (but in this example its just static menu items) But need for the menu items to be replaced with dynamic ones from the record set. Could you help to insert the dynamic code replacing the static menu items below (<p>Home</p> AND <p>Domestic</p> I have been experiementing with different approaches but nothing works as of yet :(
I did try the below code without any HTML in the echo and just simple echo'd the dymanic code from my record set..however it only displayed the first record so it wasnt going through the whole recordset...then I stupidly messed around with the code putting in a repeat region around the below code and changed some of the references then I got the recordset working however it was echo'ing duplicates (eg HOME HOME DOMESTIC DOMESTIC). So not sure why that way :-/
---------------------------------------------------------------------------
<?php
for($i = 0; $i < $totalRows_rsTopMenu; $i++)
{
$row = mysql_fetch_array($rsTopMenu);
if($i % 2) {
echo '<div class="nav"><p>Home</p><p><img src="../images/hand.jpg" width="38" height="44"></p></div>';
} else {
echo '<div class="nav"><p><img src="../images/hand.jpg" width="38" height="44"></p><p>Domestic</p></div>'; }
}
?>
---------------------------------------------------------------------------
my recordset is:
mysql_select_db($database_rainbowdb, $rainbowdb);
$query_rsTopMenu = "SELECT * FROM topmenu";
$rsTopMenu = mysql_query($query_rsTopMenu, $rainbowdb) or die(mysql_error());
$row_rsTopMenu = mysql_fetch_assoc($rsTopMenu);
$totalRows_rsTopMenu = mysql_num_rows($rsTopMenu);
---------------------------------------------------------------------------
Regards
Chris