Announcement

Collapse
No announcement yet.

Tutorial Video Dynamic Menu

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tutorial Video Dynamic Menu

    Hello,

    I have created from the video tutorial 1 by 1 a dynamic menu
    but when I run it I get the following error message

    Parse error: syntax error, unexpected '$id_item' (T_VARIABLE), expecting ']' in D:\Programme\NetMake\v8\wwwroot\scriptcase\app\Blu eOrganizer\menu\index.php on line 640

    Can anybody help me?

    my code by menu Event onLoad

    sc_appmenu_reset(menu);
    sc_appmenu_create(menu);


    sc_lookup(dsmenu,"
    SELECT
    id,
    parent,
    description,
    link
    FROM
    menu
    ORDER BY
    parent,
    node_order");

    foreach({dsmenu} as $arr_menu){
    $id_item = 'item_'.$arr_menu[0];

    if ($arr_menu[1] == 0){
    $id_parent = '';
    }else{
    $id_parent = 'item_'.$arr_menu[1];
    }

    sc_appmenu_add_item(
    'menu'
    $id_item, // line 640
    $id_parent,
    $arr_menu[2],
    $arr_menu[3],
    "","","",""
    );
    }

  • #2
    Yoy miss a ',' between 'menu' and $id_item, // line 640
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      Hi Giu
      Thx a lot, its running fine.
      In the Tutorial Video the ',' is also missing.

      regards

      Comment


      • #4
        Hi Giuseppe,

        as I said it is running.
        I use only one menu (menu_Contacts) and only one grid (grid_Contacts) and i use the Security_groups as menu Table

        Now I want a filter for the different groups in the SQL statement set of the grid_Contacts such as "WHERE group_id = '[id_item]' or in the event OnExecute of the menu_Contacts

        how can i do this, how i bring the id_item to the onExecute event of the menu_Contacts or in the SQL Statement of the grid_Contacts.

        here my sources
        ------------------
        menu_Contacts Event onLoad

        sc_appmenu_reset(menu_Contacts);
        sc_appmenu_create(menu_Contacts);


        sc_lookup(cmenu,"
        SELECT
        group_id,
        description
        FROM
        Security_groups");

        foreach({cmenu} as $arr_menu){
        $id_item = 'item_'.$arr_menu[0];

        if ($arr_menu[1] == 0){
        $id_parent = '';
        }else{
        $id_parent = ''; // $id_parent = 'item_'.$arr_menu[1];
        }

        sc_appmenu_add_item(
        'menu_Contacts',
        $id_item,
        $id_parent,
        $arr_menu[1],
        'grid_Contacts', // $arr_menu[3],
        "","","",""
        );
        }

        ----------------------

        menu_Contacts // event onExecute only test but not running

        $Selected_Group = [id_item];
        sc_set_global($Selected_Group);
        -----------------------------------

        grid_Contacts

        SELECT
        ....
        ....

        WHERE SG.group_id = '[Selected_Group]' // from the event onExecute but is not running

        Comment


        • #5
          {sc_menu_item} stores the ID of the menu clicked.
          /Giuseppe

          Professional Scriptcase Services
          Some Customers opinions

          Comment


          • #6
            thx for the fast response.

            the result is for example "item_2", but i need the group_id of this "item" in this example "2". Or can i remove the text "item_" from "item_2"

            Comment


            • #7
              Originally posted by salvatore@reinemuth.ch View Post
              thx for the fast response.

              the result is for example "item_2", but i need the group_id of this "item" in this example "2". Or can i remove the text "item_" from "item_2"
              If the number fits the ID you need yes of course, is a String
              /Giuseppe

              Professional Scriptcase Services
              Some Customers opinions

              Comment


              • #8
                Hi Giuseppe,

                I have tested with add 2 groups, remove 1 group, and add a new one , the id really corresponds to the item_XX. This means that the look item_xx for the id in the table. NICE
                Thanks a lot Giuseppe. ScriptCase is realy nice

                Comment

                Working...
                X