Jump to content

Add menu item to home-shortcuts navigation


graisbeck

Recommended Posts

Hi,

I can add a menu item to the primary and secondary navbars no problem (thanks to brian!), but how do I add a menu item to the "how can we help today" navigation? I've already created my SSL products which automatically show in the sidebar navigation, but I want the link to be available from the homepage too.

 

Any help would be greatly appreciated!

Edited by graisbeck
Link to comment
Share on other sites

to do that you need to go old skool and edit a template! :)

 

if you take a look in header.tpl, you see the following code...

 

    <div class="home-shortcuts">

that entire block of code controls the menu that you're talking about - so you'll need to add your link in there.

Link to comment
Share on other sites

to do that you need to go old skool and edit a template! :)

 

if you take a look in header.tpl, you see the following code...

 

    <div class="home-shortcuts">

that entire block of code controls the menu that you're talking about - so you'll need to add your link in there.

 

Hi brian!,

 

I've got the link working (as image shows)but I don't understand how the ID (id="btnOrderHosting") works, so I have used the same ID as the hosting link and copied the url as used in the sidebar menu to link the page, as below. I feel sure you will correct me on this :lol:

 

                       <li>
                           <a id="btnOrderHosting" href="cart.php?gid=2">
                               <i class="fa fa-lock" aria-hidden="true"></i>
                               <p>
                                   {$LANG.sslcerts} <span>»</span>
                               </p>
                           </a>
                       </li>   

Link to comment
Share on other sites

I've got the link working (as image shows)....

what image! :?:

 

but I don't understand how the ID (id="btnOrderHosting") works, so I have used the same ID as the hosting link and copied the url as used in the sidebar menu to link the page, as below. I feel sure you will correct me on this :lol:

IDs should always be unique... the world won't end because it doesn't have one, but ideally you should give it a unique ID - it won't matter what.

Link to comment
Share on other sites

what image! :?:

 

 

IDs should always be unique... the world won't end because it doesn't have one, but ideally you should give it a unique ID - it won't matter what.

 

Sorry brian ;) image attached. So does the unique ID actually process anything? I know it has it's uses in HTML and CSS etc, but I couldn't work out why it is included.

 

ssl-certs.jpg

Link to comment
Share on other sites

So does the unique ID actually process anything? I know it has it's uses in HTML and CSS etc, but I couldn't work out why it is included.

I think it's included so that you have the option to reference it directly - but you can do that whatever the ID is called... I doubt it will be bestowed with any magical powers and there aren't any specific references to them in the css files.

Link to comment
Share on other sites

graisbeck said:
Thanks brian! I also meant to ask - how do I add fa icons to the sidebar navigation menu items? I've looked in sidebar.tpl, includes/hooks and sidebar cheatsheet, but couldn't find the actual links.

for the sake of argument, i'm going to assume it's an existing sidebar with children - if it were a new sidebar/child, then you could just add 'icon' => 'fa-circle' to the creating array (as shown in the documentation).

 

but let's take the categories sidebar as an example - this is what it might look like by default...

 

B9hkEy1.png

 

a little drab, but we can add icons using the following hook...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $SecondarySidebar)
{
   if(!is_null($SecondarySidebar->getChild('Categories'))){
               $SecondarySidebar->getChild('Categories')
               ->getChild('Shared Hosting')
               ->setIcon('fa-server fa-fw');

               $SecondarySidebar->getChild('Categories')
               ->getChild('Game Servers')
               ->setIcon('fa-gamepad fa-fw');

               $SecondarySidebar->getChild('Categories')
               ->getChild('Addons')
               ->setIcon('fa-plus-circle fa-fw');
   }
});
 
DTyp5Je.png

 

btw - if the sidebars look slightly different, this is because i'm doing this in a v7.2 dev... so this is what v7.2 is going to look like later this month.

 

sometimes you won't need the fa-fw part (which is just to give them a fixed width).

 

so in summary you can just use setIcon to assign a fontawesome/glyphicon to a child... same principle works for the navbar too. :idea:

NOTE: updated for v7.6 in the thread below..

 

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