Jump to content

navbar whmcs


magicgirl

Recommended Posts

hello folk,

I am sandra from germany and totally happy with whmcs.

But I have a question about the "changing where a menu item links to".

https://developers.whmcs.com/themes/navigation/

I read it and can not understand in which file I have to put this inside?

So where I have to put the seturi file inside and which parameters do i have to change ?

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
    $navItem = $primaryNavbar->getChild('Support');
    if (is_null($navItem)) {
        return;
    }

    $navItem = $navItem->getChild('Announcements');
    if (is_null($navItem)) {
        return;
    }

    $navItem->setUri('https://www.example.com/3rdpartyblogsystem');

 

could you please help me

Link to comment
Share on other sites

Hi @magicgirl

You have two options in the way that you can do this both will give you the same result but the 'hook' option is the better (in my opinion).

The first option is to locate either the 'header.tpl' or 'navbar.tpl' files that are located inside your template directory (for example) '/var/www/html/whmcs/templates/my_template_name/includes/navbar.tpl' you can then edit the menu item directly in there once you have located it.

Or the better option is to create a 'hooks' folder in you template directory (/var/www/html/whmcs/templates/my_template_name/includes/hooks/) and then add a new file in there with the code above which will then 'overwrite' what has been generated by the whmcs default template.

Details about how the hooks work can be found at https://developers.whmcs.com/hooks/

Link to comment
Share on other sites

21 hours ago, redit said:

The first option is to locate either the 'header.tpl' or 'navbar.tpl' files that are located inside your template directory (for example) '/var/www/html/whmcs/templates/my_template_name/includes/navbar.tpl' you can then edit the menu item directly in there once you have located it.

I wouldn't suggest editing the navbar.tpl unless you know what you're doing - and a new user is highly unlikely to know how to do it.

21 hours ago, redit said:

Or the better option is to create a 'hooks' folder in you template directory (/var/www/html/whmcs/templates/my_template_name/includes/hooks/) and then add a new file in there with the code above which will then 'overwrite' what has been generated by the whmcs default template.

that's incorrect advice - the /includes/hooks/ directory already exists within the root of your WHMCS installation and contains an example.php hook file - there is no need to create an /includes/hooks/ folder inside your current template folder - and any hook files in there wouldn't work anyway.

GR1l55M.png

Link to comment
Share on other sites

@brian!

I was trying to give all the options available as not knowing the posters level.

And thank you for spotting the error you are of course 100% correct on the location of the hook folder, that will teach me to double check what I write in future.

 

~Regards,

Scott

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated