Xoops Menus

Embed Size (px)

Citation preview

  • 8/11/2019 Xoops Menus

    1/14

    Xoops Menus

  • 8/11/2019 Xoops Menus

    2/14

    Main Menu

    The Main Menu in Xoops is integratedthroughout the core files, so it can't bealtered without serious coding. All modules

    automatically have links added to the mainmenu. These links normally lead to themodule's first page, normally called the"index page". The link to the module in the

    main menu is named after the module'sname. But some extra url links can beadded with a little tweaking and know-how.

  • 8/11/2019 Xoops Menus

    3/14

    How to change the name of a

    module's link in the main menu

    To do this you must change the name ofthe module. Go to System Admin->Modules. Then look for the module you

    wish to change the name of, and renamein the module name text box. Click"update". The link in the main menu will

    change to this new name.

  • 8/11/2019 Xoops Menus

    4/14

    How to re-order links in the main

    menu

    To do this go to System Admin->Modules. Then look for the Order (0 =hide) column. The numbers represent the

    order of sequence the links will appear inthe main menu, from lowest to highest i.e.1,2,3..etc. Add your number sequence foreach module and then click submit. You

    can add numbers with gaps between toallow the easy insertion of more moduleslater i.e. 4,6,8 etc

  • 8/11/2019 Xoops Menus

    5/14

    How to hide an installed

    module's link in the main menu

    To hide a link to a module in the mainmenu go to System Admin-->Modules andlook for the Order ( 0=Hide ) column to

    the right of the module. Change the "1" toa "0" (Zero). Although the link is hidden inthe main menu the module is still active

  • 8/11/2019 Xoops Menus

    6/14

    How to add your own url links to

    your main menu You must firstly edit the main menu files located

    in System Admin-> Templates-> System->system_block_mainmenu.html

    But to do this you must alter a templatefile. Thedefault templatecant be edited without cloning.If you are using the default Xoops template youneed to click on "Clone" and then set up the

    clone as your default template in GeneralSettings. You may call this clone anything youwish. If you don't call it anything Xoops will add adefault name.

  • 8/11/2019 Xoops Menus

    7/14

    If you are using another theme apart from Xoopsdefault, it it will normally be based on the Xoopsdefaulttemplate, if not, the theme youdownloaded would have a compressed file witha "tar.gz" extension to upload into templates (tocreate its own template)

    You may need to click on "Generate" for somemodules to create the editable files. Thesemodule files that need to be generated arecolored red.

  • 8/11/2019 Xoops Menus

    8/14

    After you have set up your defaulttemplate in general settings, go back toSystem Admin-> Templates--your default

    template will have a tick against it. Nowlook for the "System" set of files and clickon "List"

  • 8/11/2019 Xoops Menus

    9/14

    In there you will find a file called system_block_mainmenu.html Click on "Edit

    The file should look similar to this:

    BournemouthXoops CMS

  • 8/11/2019 Xoops Menus

    10/14

    Notice after the Ihave added a couple of lines i.e.

    BournemouthXoops CMS

    The first line provides a link to a file on myserver

  • 8/11/2019 Xoops Menus

    11/14

    The second provides a link to another site, no need fortarget_blank, but to open in new window addtarget="_blank" i.e.

    Xoops CMS

    (Remember to use the same "classes" your Template is

    using, these classes are defined in your style.css file inyour themes folder)

  • 8/11/2019 Xoops Menus

    12/14

    Hiding Submenus for

    Unregistered Users

    Each module has any related submenusdefined in the xooops_version.php file inthe individual modules root folder.

    For example to hide the submit menu fromthe anon users group in the News modulelook for the Menu code:

  • 8/11/2019 Xoops Menus

    13/14

    // Menu$modversion['hasMain'] = 1;global $xoopsUser;

    if(!empty($xoopsUser)) {$group = $xoopsUser->getGroups();

    if (in_array(2, $group)) { //or other group-IDs$modversion['sub'][1]['name'] = _MI_NEWS_SMNAME1;

    $modversion['sub'][1]['url'] = "submit.php";}}$modversion['sub'][2]['name'] = _MI_NEWS_SMNAME2;$modversion['sub'][2]['url'] = "archive.php";

    In this one anon users will see the archive sub-menuonly

  • 8/11/2019 Xoops Menus

    14/14

    Notice this line

    if (in_array(2, $group)) { //or other group-IDs

    group 2 = registered usersgroup 1 = webmasters

    At the time of writing I understand that thenext News module will have this abilityincluded.