Operating Instructions

Theory of operation

Mymenus separates logic from presentation almost 100%!
It is mymenus task to generate an array with menus information and let each skin decide what to do with that information.
How can skin know when to open a new <li> or <ul> and when to close it?
Mymenus append that information to each menu item, that way you can know if that item should be prefixed with a or not.
This is the composition of an item array:
1
[id] => 3 (id of the menu item)
2
[pid] => 0 (id of the parent menu item)
3
[mid] => 2 (id of the menu package)
4
[title] => Home (title of the menu item)
5
[alt_title] => Home (alt/title of the menu item)
6
[visible] => 1 (visibility of the menu item, it will be 1 for all menus,you can disregard it)
7
[link] => http://localhost/xoops-2.4.5/htdocs/ (alt/title of the menu item)
8
[weight] => 1 (this is for internal usage of the builder class, you can disregard it)
9
[target] => _self (to be used in link target element, it can be _self, _blank, etc..)
10
[groups] => Array (holds the groups who can view this link, you can disregard it)
11
([0] => 2
12
[1] => 3
13
)
14
[hooks] => Array (holds the hooks available to render the menu, you can disregard it)
15
()
16
[image] => (image to be used in the link, you can choose not to support it in your skin)
17
[css] => (this is inline css for this item, it goes inside <a style="$item.css">)
18
[oul] => 1 (IMPORTANT! Open UL -> this menu item requires skin to prepend <ul> open element tag)
19
[oli] => 1 (IMPORTANT! Open LI -> this menu item requires skin to prepend <li> open element tag)
20
[close] => (IMPORTANT! this holds closing tags, it will automatically generate </li></ul> tags for you)
21
[cul] => (IMPORTANT! Close UL -> this menu item requires skin to append </ul> close element tag, you should use [close] instead, unless you are not supporting multilevel menus)
22
[cli] => (IMPORTANT! Close LI -> this menu item requires skin to append </li> close element tag, you should use [close] instead, unless you are not supporting multilevel menus)
23
[hassub] => 1 (informs if this menu item has submenus, 1 for true, 0 for false)
24
[level] => 0 (informs the level of nesting of the menu item, 0 is for root, 1 for second level, etc..)
25
[down_weight] => 3 (for usage in menu sorting in admin side, you can ignore it)
26
[selected] => 1 (IMPORTANT, this tells the skin to highlight this item)
27
[topselected] => 1 (Important, this informs the skin that the menu is of level 0(root) and it is selected, you should highlight it)
28
)
Copied!

Skin structure

Skins go into
1
"mymenus/skins" folder or
2
3
"public_html/themes/yourtheme/menu" folder
Copied!
and they should have a skin_version.php file in it
skin_version.php structure:
1
//informs where to find the template for this skin(relative to skin folder)
2
3
$skinVersion['template'] = 'templates/template.tpl';
4
5
//informs where to find css file/files
6
7
$skinVersion['css'] = 'assets/css/superfish.css';
Copied!
or
1
$skinVersion['css'] = array('css/superfish.css', css/anotherone.css);
2
3
//informs where to find js file/files
4
5
$skinVersion['js'] = '../../js/assets/jquery-1.3.2.min.js';
Copied!
or
1
$skinVersion['js'] = array(
2
3
'../../js/jquery-1.3.2.min.js'
4
5
'../../js/assets/hoverIntent.js',
6
7
'../../js/superfish.js'
8
9
);
Copied!
//code to be appended in the theme tag
1
$header = "\n" . '<script type="text/javascript">';
2
$header .= "\n" . ' var $sf = jQuery.noConflict()';
3
$header .= "\n" . ' $sf(function(){';
4
$header .= "\n" . ' $sf(\'ul.sf-menu\').superfish({';
5
$header .= "\n" . ' delay: 1000,';
6
$header .= "\n" . ' animation:
7
{opacity:\'show\',height:\'show\'},';
8
$header .= "\n" . ' speed: \'fast\'';
9
$header .= "\n" . ' });';
10
$header .= "\n" . ' });';
11
$header .= "\n" . '</script>';
12
$skinVersion['header'] = $header;
Copied!
//you can pass any configuration from this file to the template using ['config']
example:
1
$skinVersion['config']['home'] = true;
2
$skinVersion['config']['iconset'] = 'default';
Copied!
This can be fetched in template with <{$config.home}> and <{$config.iconset}>

Smarty variables available in the template

1
$block - holds an array of menu items
2
$config - holds configuration set in skin_version.php
3
$skinurl - holds the url of the skin
4
$skinpath - holds the path of the skin
Copied!

For Theme designers

Since users can choose the smarty variable for each menu,
I would advise you to use <{$xoops_links_navbar}> as a place holder.
If you provide a skin for your theme, ask users to:
1
-- --enter "xoops_links_navbar" as unique_id in block settings.
2
3
-- --set "render to smarty variable" in block settings.
4
5
-- --set "use skin from theme" in block settings.
Copied!

Important to know:

Links and images are relative to the root of your site:
1
modules/profile
2
search.php
3
uploads/blank.gif
Copied!
For linking to external sites you need to use complete url:
You can use DECORATORS for links, images, title, and alt_title.
The decorators follow this syntax:
1
{decorator|value}
Copied!
There are 6 decorators available:
  • USER -> gets info for the user that is seeing the page
  • OWNER -> gets info for the user that match uid on the url(if given)
  • URI -> gets info about the url arguments
  • MODULE -> gets dynamic menu from a module (Used in title field only)
  • SMARTY -> gets smarty variables
  • CONSTANT -> gets defined constants
Some syntax examples{USER|UNAME} gets the username of this user, returns anonymous if not a user{USER|UID} gets the uid of this user, returns 0 if not a user{USER|REGDATE} gets the regdate of this user, returns empty if not a user{USER|any other field of the user table} yes! You can get what you need!Some special fields you may use:
1
{USER|PM_NEW} Show number of private messages not read
2
{USER|PM_READED}
3
{USER|PM_TOTAL}
Copied!
The same is valid for OWNER:
1
{OWNER|UNAME}
2
{OWNER|UID}etc..
Copied!
And you can get any parameter on the uri with:
1
{URI|UID}{URI|ID}
2
{URI|SEARCH}
3
{URI|ITEMID}
4
{URI|CATID}etc...
Copied!
Example of links using decorators:
1
modules/profile/userinfo.php?uid={USER|UID}
2
modules/yogurt/pictures.php?uid={OWNER|UID}
Copied!
Example on titles using decorators:
1
{USER|UNAME}
2
{OWNER|UNAME} profile
Copied!
You have searched for {URI|SEARCH}Populating menus with modules information:
1
{MODULE|NEWS}
2
{MODULE|XHELP}
3
{MODULE|MYLINKS}
4
{MODULE|TDMDOWNLOADS}
Copied!
Using smarty information:
1
{SMARTY|xoops_uname}
2
{SMARTY|xoops_avatar}
Copied!
Using constants information:
1
{CONSTANT|XOOPS_URL}/myimages/image.gif
2
{CONSTANT|XOOPS_ROOT_PATH}
Copied!