Announcement

Collapse
No announcement yet.

[SOLVED]Dynamically generated menus

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED]Dynamically generated menus

    Hi there,

    I have some nifty onLoad code in a Menu application that generates the menu from a MySQL Query, namely:
    Code:
    sc_appmenu_reset(menu);
    sc_appmenu_create(menu);
    sc_lookup(menulevel1, "SELECT menu_id, menu_description, application, parameters, icon, target FROM ss_menu WHERE activeflag_id='1' AND parent_id='0' ORDER BY sequence ASC;");
    if(!empty({menulevel1})) {
    	foreach({menulevel1} as $a_1menu) {
    		if($a_1menu[3] != NULL) { $id_params=$a_1menu[3]; } else { $id_params=''; }
    		sc_appmenu_add_item('menu', 'item_' . $a_1menu[0], '', $a_1menu[1], $a_1menu[2], $id_params, $a_1menu[4], '', $a_1menu[5]);
    		sc_lookup(menulevel2, "SELECT menu_id, menu_description, application, parameters, icon, target FROM ss_menu WHERE activeflag_id='1' AND parent_id='" . $a_1menu[0] . "' ORDER BY sequence ASC;");
    		if(!empty({menulevel2})) {
    			foreach({menulevel2} as $a_2menu) {
    				if($a_2menu[3] != NULL) { $id_params=$a_2menu[3]; } else { $id_params=''; }
    				sc_appmenu_add_item('menu', 'item_' . $a_2menu[0], 'item_' . $a_1menu[0], $a_2menu[1], $a_2menu[2], $id_params, $a_2menu[4], '', $a_2menu[5]);
    				sc_lookup(menulevel3, "SELECT menu_id, menu_description, application, parameters, icon, target FROM ss_menu WHERE activeflag_id='1' AND parent_id='" . $a_2menu[0] . "' ORDER BY sequence ASC;");
    				if(!empty({menulevel3})) {
    					foreach({menulevel3} as $a_3menu) {
    						if($a_3menu[3] != NULL) { $id_params=$a_3menu[3]; } else { $id_params=''; }
    						sc_appmenu_add_item('menu', 'item_' . $a_3menu[0], 'item_' . $a_2menu[0], $a_3menu[1], $a_3menu[2], $id_params, $a_3menu[4], '', $a_3menu[5]);
    						sc_lookup(menulevel4, "SELECT menu_id, menu_description, application, parameters, icon, target FROM ss_menu WHERE activeflag_id='1' AND parent_id='" . $a_3menu[0] . "' ORDER BY sequence ASC;");
    						if(!empty({menulevel4})) {
    							foreach({menulevel4} as $a_4menu) {
    								if($a_4menu[3] != NULL) { $id_params=$a_4menu[3]; } else { $id_params=''; }
    								sc_appmenu_add_item('menu', 'item_' . $a_4menu[0], 'item_' . $a_3menu[0], $a_4menu[1], $a_4menu[2], $id_params, $a_4menu[4], '', $a_4menu[5]);
    							}
    						}
    					}
    				}
    			}
    		}
    	}	
    }
    When Generated and Run, this code generates the following syntax error in the browser:
    Code:
    Parse error: syntax error, unexpected '"*scout"' (T_CONSTANT_ENCAPSED_STRING) in /opt/NetMake/v8/wwwroot/scriptcase/app/ServiceUnity/menu/index.php on line 882
    If I log in to my server via SSH, open the above referenced PHP script with VIM, and go to line 882, I see the following (bad) code:
    Code:
    scriptcase']['sc_def_menu']["menu"]['item_' . $a_1menu[0]]['parm']           = $id_params . "*scin""*scout" . "nm_run_menu*scin1*scout";
    It looks like this could be as simple as a period [.] missing from the space between "scin" and "*scout"

    Can someone fix this bug and push it out in an update, please?

    For any who search and find this post, the fix for this is generally simple.... exclude the parameters option from your sc_appmenu_add_item() statement. But it defeats the purpose of the parameters option if it doesn't work. :-)

    Thanks!

  • #2
    Hello,

    Issue reported to our bugs team.

    regards,
    Bernhard Bernsmann

    Comment


    • #3
      Is there any solution?

      Comment


      • #4
        Hello.
        This problem does not this is a bug.

        The macro sc_appmenu_add_item not pass parameters through variables.
        As shown in the code: sc_appmenu add_item ('menu', 'item_' $ a_1menu [0], '', $ a_1menu [1], $ a_1menu [2], $ id_params, $ a_1menu [4] ''. $ a_1menu [5]);
        Parameters: $id_params

        The macro should be used as follows:
        Parameters - String with parameters to pass to the menu item application.
        Ex .: param1 = value; param2 = value


        More information: http://www.scriptcase.net/docs/en_us...pmenu_add_item

        Comment

        Working...
        X