Wdes Posted March 5, 2018 Share Posted March 5, 2018 Hello guys, I search for activate the active page on the six-template I found some old topics for sorry it's not useful and needs a manual way to activate each page separately and in attachment an example of what I wanna Waiting to hear from you Thank you. Link to comment Share on other sites More sharing options...
twhiting9275 Posted March 6, 2018 Share Posted March 6, 2018 I'm not terribly sure that's possible post 6 , though it might be. Take a look at the theme documentation If what you're after is possible it should be there Link to comment Share on other sites More sharing options...
brian! Posted March 7, 2018 Share Posted March 7, 2018 On 3/6/2018 at 20:28, twhiting9275 said: I'm not terribly sure that's possible post 6 , though it might be. that's covering yourself! On 3/6/2018 at 20:28, twhiting9275 said: Take a look at the theme documentation - If what you're after is possible it should be there. good luck finding how to do this via the documentation. On 3/5/2018 at 18:31, Des Team said: I found some old topics for sorry it's not useful and needs a manual way to activate each page separately if the old topics showed you how to change one menu item, then you know how to change many.... in fact, there are a number of ways to do it - some of which are nastily complex, but one simple way to do it would be... <?php # Primary Navbar Active Class # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { GLOBAL $smarty; $templatefile = $smarty->getVariable('templatefile'); $filename = $smarty->getVariable('filename'); $action = $smarty->getVariable('action'); $filelinks = array('Store' => 'cart','Affiliates' => 'affiliates','Open Ticket' => 'submitticket','Support' => 'supporttickets'); $templatelinks = array('Announcements' => 'announcements','Knowledgebase' => 'knowledgebase','Server Status' => 'serverstatus','Services' => 'clientareaproducts','Domains' => 'clientareadomains'); $billinglinks = array('invoices','quotes','addfunds'); $homelinks = array('homepage','clientareahome'); $supportlinks = array('supportticketslist','announcements','knowledgebase','downloads','serverstatus'); $currentfile = array_search($filename, $filelinks); $currentpage = array_search($templatefile, $templatelinks); if (!is_null($primaryNavbar->getChild($currentfile))) { $primaryNavbar->getChild($currentfile) ->setClass(( ! isset($_GET['modop']) ? 'active' : '')); } elseif (!is_null($primaryNavbar->getChild($currentpage))) { $primaryNavbar->getChild($currentpage) ->setClass(( ! isset($_GET['modop']) ? 'active' : '')); } elseif (in_array($action, $billinglinks) & !is_null($primaryNavbar->getChild('Billing'))) { $primaryNavbar->getChild('Billing') ->setClass(( ! isset($_GET['modop']) ? 'active' : '')); } elseif (in_array($templatefile, $homelinks) & !is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home') ->setClass(( ! isset($_GET['modop']) ? 'active' : '')); } elseif (in_array($templatefile, $supportlinks) & !is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Support') ->setClass(( ! isset($_GET['modop']) ? 'active' : '')); } }); if the structure of the navbar links made any logical sense, you could reduce this code down - but with the above method, you end up having to check filenames, template names and actions to cover all the options. if you've added any custom navbar parent items, you'd need to manually add them to the hook.... and looking at the code again, I think i've missed off the contact us link. Link to comment Share on other sites More sharing options...
twhiting9275 Posted March 7, 2018 Share Posted March 7, 2018 3 hours ago, brian! said: that's covering yourself! That's what I do best. I just wasn't sure if it was possible to do, glad to be proven wrong Link to comment Share on other sites More sharing options...
Recommended Posts