Deluxe Tree Menu Populate Problem...

aldus

Sorry - not exactly,

but the princip is always the same:

object - status: stand_still,
call object -> startmove
object - status: move
object is calling a timeout script
timeout-script: is calling the object to move
object ist testing his position and
   if hitting the target his state is -> still again
  timout-script: makes nothing
else
  call timeout-script again

Very psydo-coded, but i thing this is the way it could be done .

Regards
Aldus

StefanRSA

Thanks Aldus.

Do you know how to get the effect how a menu will "Glide" down instead of just dropping down.
I could only up to now, do it with JS or Flash... I serve clients in South Africa and the internet connection standards here is 3rd world... Flash is therefore a NO NO!!!

I know I can get nice visual effect with CSS but dont know how to get the "Glide Down" effect....

Any sugestions?
How can the sky be the limit? There is much more behind the sky!!!

aldus

Made some codecleanings to get it a little bit more readable

<?php

/**
*    @version    0.2.0
*    @date        2008-08-13
*    @author        StefanRSA
*    @package    WebsiteBaker - Module : <no name>
*    @state        @dev
*
*
*/

function getMenuItems() {
    
    
$jsItems '';

    
/**
    *    Select all records from table "menuTable"
    */
    
$connection mysql_connect('localhost','website','website') or die ('No Connection!');

    
mysql_select_db('wb') or die ('Unable to connect to DB!');
    
    
$allItems mysql_query('SELECT page_title, page_id, parent, level, menu_title, link FROM pages;');

    
/**
    *    Extract items data from database and build Javascript code for menuItems
    */
    
$menuSub=array();
    
    while (
$itemData mysql_fetch_array($allItems)) {
        
        if(
$itemData['page_title']=='PRODUCT DETAIL') {
            
/**
            *    dropdown menu title
            */
            
$menuTop[$itemData['page_id']]='["'.$itemData['menu_title'].'","","","","","","","1","",""]';
        }
        elseif ( 
$itemData['level']==0) {
            
/**
            *    top level menu item
            */
            
$menuTop[$itemData['page_id']]='["'.$itemData['menu_title'].'","'.'http://newhost.try/wb/pages'.$itemData['link'].'.php'.'","","","","","","1","",""]';
        }
        elseif( 
$itemData['level']==1) {
            
/**
            *    sub level menu item
            */
            
$menuSub[$itemData['parent']][]="\t".'["|'.$itemData['menu_title'].'","'.'http://newhost.try/wb/pages'.$itemData['link'].'.php'.'","","","","","","0","",""]';
        }
    }

    foreach( 
$menuTop AS $menuId=>$menuLinkTop){
        
$itemArr[]=$menuLinkTop;   //add top-level links
        
        /**
        *    check for sub menu
        */
        
if( array_key_exists($menuId,$menuSub)) {
            
            
/** 
            *    add sub-menu links
            */
            
foreach($menuSub[$menuId] AS $menuLinkSub$itemArr[]=$menuLinkSub;
    
        }
    }

    
/**
    *    join $itemArr together with ,'s and new lines
    */
    
$jsItems=implode(",\n",$itemArr);
    
    
/**
    *    Return Javascript code
    */
    
return $jsItems;
}

?>



Basicly i like the idea to store the data inside a list and implode it with linebreak;
but also i think the hardcode main-links and the db-connection could be problematic, instead of
using WB constants like "WB_PATH" ...

Regards
Aldus

StefanRSA

HI guys...

Thanks for the replies... I worked it all out... I had to make an manual DB query to get the menu working...
And yes. I was looking for the FLYOUT effect for the menu... If CSS can do the same, I will have to look into it.
Any Sugestion for where I should look to find a solution???

If anybody asks, here is the code I used to populate the menu.......

<?php

function getMenuItems()
{
$jsItems = '';

// Select all records from table "menuTable"
$connection = mysql_connect('localhost','website','website')
or die ('No Connection!');

mysql_select_db('wb')
or die ('Unable to connect to DB!');
$allItems = mysql_query('SELECT * FROM pages;');

// Extract items data from database and build Javascript code for menuItems
$menuSub=array();
while ($itemData=mysql_fetch_array($allItems)){
if($itemData['page_title']=='PRODUCT DETAIL'){
   //dropdown menu title
   $menuTop[$itemData['page_id']]='["'.$itemData['menu_title'].'","","","","","","","1","",""]';
   }
elseif($itemData['level']==0){
   //top level menu item
   $menuTop[$itemData['page_id']]='["'.$itemData['menu_title'].'","'.'http://newhost.try/wb/pages'.$itemData['link'].'.php'.'","","","","","","1","",""]';
   }
elseif($itemData['level']==1){
   //sub level menu item
   $menuSub[$itemData['parent']][]="\t".'["|'.$itemData['menu_title'].'","'.'http://newhost.try/wb/pages'.$itemData['link'].'.php'.'","","","","","","0","",""]';
   }
   }
foreach($menuTop AS $menuId=>$menuLinkTop){
   $itemArr[]=$menuLinkTop;    //add top-level links
   if(array_key_exists($menuId,$menuSub)){    //check for sub menu
       foreach($menuSub[$menuId] AS $menuLinkSub){
           $itemArr[]=$menuLinkSub;    //add sub-menu links
           }
       }
   }
   
$jsItems=implode(",\n",$itemArr);    //join $itemArr together with ,'s and new lines
return $jsItems;    // Return Javascript code
}

?>


And then the menu was populated with:

var tmenuItems = [

<?php
// Write Javascript code for menu items
echo getMenuItems();
?>
];


I tried to contact the guys at Deluxe Menu for help.................. Sad to say... These guys just don't reply to emails! They are trying to sell a product with NO SUPPORT!!!!

Will make my template available as soon as it goes live!
How can the sky be the limit? There is much more behind the sky!!!

marathoner

Quote from: StefanRSA on August 05, 2008, 04:19:08 PM
I am using Deluxe Menu to create an XP Style Tree menu.
Can anybody please help me... I realy dont know how to populate the menu from the documents created on the site... I got my own template up and running. My static menu is also working fine...

I am trying to get the menu to populate itself like the show_menu2 module.....


What are you actually trying to accomplish? There are usually many ways to solve a problem.

Is there simply a certain look that you prefer? If so, you could likely style your menu using CSS.
Is it because it's a vertical fly-out menu? Again, CSS can be used to accomplish this

Be aware that a JS based menu such as Deluxe Menu will only work if the user has not disabled JS. I disabled JS in my browser and looked at the Deluxe Menu XP Tree example and it did not work.

The combined capabilities of show_menu2 and CSS can provide a great deal of flexibility. You might want to look more into these options before deciding to implement a commercial, proprietary JS package.

flamenco

Quote from: StefanRSA on August 05, 2008, 04:19:08 PM
I am using Deluxe Menu to create an XP Style Tree menu.
Can anybody please help me... I realy dont know how to populate the menu from the documents created on the site... I got my own template up and running. My static menu is also working fine...

I am trying to get the menu to populate itself like the show_menu2 module.....

I am new to PhP and just need to get shown a direction in what I should do or what I should look up to get an answer...

PLEASE CAN ANYBODY HELP!!!!
Stefan,
I took a quick look at Deluxe Menu.  Evidently this is a Javascript menu.  show_menu in both its incarnations is PHP-based, and will generate menus from the WB site documents.  BUT... Deluxe Menu is a separate application, so there is no way that I know of to make the two items work together, especially if you're not proficient at PHP.

Maybe you're proficient at CSS?  If so, maybe you could observe the styles used and then incorporate the stylesheets and images into WB so that your show_menu will have that look.  I have been asked to do all kinds of totally crazy menus, and I've used such a procedure to get wild menus into WB and other CMS systems. 

And because it's Javascript, a really sharp Javascript coder might be able to work this out, probably needing to write a LOT of code.  But as you're a PHP novice, I'm guessing that this is not the case. 

I'm sure this is not the answer you wanted to hear.  Truthfully, I believe this is a Deluxe Menu question, and you may get a better answer there... no doubt other people have tried to fuse it with other products. 

Good luck.

MODx, Wordpress, WB Developer

StefanRSA

#1
I am using Deluxe Menu to create an XP Style Tree menu.
Can anybody please help me... I realy dont know how to populate the menu from the documents created on the site... I got my own template up and running. My static menu is also working fine...

I am trying to get the menu to populate itself like the show_menu2 module.....

I am new to PhP and just need to get shown a direction in what I should do or what I should look up to get an answer...

PLEASE CAN ANYBODY HELP!!!!
How can the sky be the limit? There is much more behind the sky!!!