Ajax vertical menus using PHP

Asked By 20 points N/A Posted on -
qa-featured

Hi Everyone,

I need to implement a Chained Ajax Vertical Menus using PHP. I am fresh to PHP and would like to have the notes along with coding on this regard. Please do the needful by providing any online materials.

Thanks

Scott Athers

SHARE
Best Answer by Cathyy Freeman
Answered By 0 points N/A #188845

Ajax vertical menus using PHP

qa-featured

Dear user,

I have done a few minutes research for your query on Google and have found some PHP codes that may help you. These scripts are easy enough and will work too. I have attached them with the solution, first one also has its PHP response.

Hope this will help you.

Thank you.

Best Answer
Best Answer
Answered By 0 points N/A #188846

Ajax vertical menus using PHP

qa-featured

 

Try this code :

$query = mysql_query ("SELECT * FROM menu ORDER BY primary ASC");

$parent=0;

$sub=0;

Echo "<UL>"; //start list

While ($menu = mysql_fetch_array ($query) {

   If ($parent != $menu ['PID']) {//if not seen the item before

      If ($sub != 0) {echo "</UL>";} else {$sub++;} //if not first submenu, close submenu before. If first sub sub++.

      Echo "<UL>";} //open submenu

   Echo "<Li>". $menu [CID]."</Li>"; //echo item

   If ($parent != $menu ['PID']) {//if not seen before

      $parent = $menu ['PID']; //set to see before so next loop will be recognized

   }

}

Echo "</UL>"; //end list

This link will help you:http://www.lotusseedsdesign.com/blog/magento-vertical-categorymenu

 

Related Questions