close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Alternating a menu system...

Thread began 10/10/2012 8:32 pm by Christopher West | Last modified 10/11/2012 3:06 pm by Christopher West | 542 views | 6 replies

Christopher WestCommunity Expert

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

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...