Product Logo

CNS Menu

Dynamic Menus

XML

insertmenuitem Tag

Nameinsertmenuitem Tag
Description

This tag allows you to insert a new menu item into any menu you have previously defined. The <insertmenuitem> tag is useful for creating menus based on records in a portal. This tag is used by itself and does not need to appear within <menu> or <submenu> tags. This tag is an almost exact replica of the <menuitem> tag, except that you must specify the “path” to the menu item you want to insert before so that CNS Menu knows where to insert the new item. If you want to insert a menu item as the last item on the menu, use “__LAST__” as the item name. You need to at least define the name and before attributes to have a valid <insertmenuitem> tag. This is an empty tag, so you can either use a forward-slash before the closing angled bracket (“/>”) or follow the tag immediately with a closing </insertmenuitem> tag.

Format
<insertmenuitem name=“menu item name” before=“path to insert before” autocreatemenu=“yes” db=“mydb” script=“myscript” value=“47” enabled=“yes” groupid=“abc” modifierkeys=“shift+ctrl” style=“bold” mark=“check” bgcolor=“#FFFF00” fgcolor=“#000” />
Required Attributes
  • name
    Defines the name of the menu item. This name appears on the menu. If the name is defined as “-”, a separator will be placed at this location in the menu instead of a normal menu item. If you are defining a menu separator, only the groupid and modifierkeys attributes will be used; all others will be ignored. The name of the chosen menu item can be retrieved using the CNSMenu_GetMenuChoice function.
  • before
    Defines the “path” to the menu item that you are inserting before. The “path” is made up of the menu name, followed by any submenu names, followed by the actual name of the menu item, all separated with the forward-slash, and looks like “menu name/submenu name/menu item name”. If inserting as the last item, use “__LAST__” as the menu item like “menu name/submenu name/__LAST__”.
Optional Attributes
  • autocreatemenu
    Defines whether or not CNS Menu should auto create the menu or any submenus specified in the “path” from the before attribute if they do not already exist. In other words, if you specify “my menu/Layouts/__LAST__” as the before attribute, but the “Layouts” submenu does not exist, CNS Menu will create it. Specify either “yes” or “no”. The default value is “no”.
  • db
    Defines the database that contains the script for this menu item. If this is not defined, the default database from the parent submenu or menu will be used. If the parent submenu or menu does not have a database defined, the current database will be used. The default value is “”.
  • script
    Defines the script to be called when the user selects this menu item. If this is not defined, the default script from the parent submenu or menu will be used. The default value is “”.
  • value
    Defines a user-supplied value for this menu item. This value can be retrieved using the CNSMenu_GetMenuValue function and is also set as the “Script Parameter” if a script is called. The default value is “”.
  • enabled
    Defines whether or not this menu item is enabled. Specify either “yes” or “no”. If the menu item is disabled, it will appear greyed and the user will not be able to select it. The default value is “yes”.
  • groupid
    Defines a user-supplied group identifier for this menu item. This is used in conjunction with the modifierkeys attribute to selectively show alternative menu items depending on which modifier keys are held down. See the Hidden Items Example in the CNS Menu example database for examples that use this attribute. This attribute is optional; default value is “”.
  • modifierkeys
    Defines the modifier keys that are required in order to show this menu item. Specify “none” or “shift”, “ctrl”, “opt”, “cmd”, or combinations using the plus sign (“shift+ctrl+cmd”). If the specified modifier keys are not held down when this menu is shown, this menu item will not be shown. If you are making a cross-platform solution, you will only want to use the “ctrl” and “shift” modifier keys because windows does not have the “opt” and “cmd” keys. The default value is “none”.
  • style
    Defines the font style of this menu item. Specify “none” or “bold”, “italic”, “underline”, or combinations using the plus sign (“bold+italic”). The default value is “none”.
  • mark
    Defines the mark for this menu item. Specify “none”, “check”, “bullet”, or “diamond”. The mark is displayed to the left of the menu item. The default value is “none”.
  • bgcolor
    Defines the background color of the item. See the menuitem Tag for an explanation of how to define the color. The default color is defined by the system.
  • fgcolor
    Defines the foreground/font color of the item. See the menuitem Tag for an explanation of how to define the color. The default color is defined by the system.