WillKruss Posted July 23 Share Posted July 23 Hi All, Try trying to get the templatefile variable inside the ClientAreaSecondarySidebar hook so I can hide certain menu items depending what page is loaded. For example, on the domain registration page I don't want to display the categories sidebar. The below unfortunately doesn't work as $smarty->getVariable('templatefile')->value doesn't work. There is a variable $templatefile which contains the value 'domainregister' if I use {debug} on the tpl page. However, I don't seem to be able to retrieve it in the global smarty variables. It's of course not exposed in the secondarysidebar variables either. Any idea how to do this? Thanks. Will. add_hook('ClientAreaSecondarySidebar', 1, function($secondarySidebar) { GLOBAL $smarty; $activeFile = $smarty->getVariable('templatefile')->value; $activeTemplate = $_SESSION['Template']; if ($activeTemplate == 'portal') && $activeFile == 'domainregister') { if (!is_null($secondarySidebar->getChildren())) { foreach ($secondarySidebar->getChildren() as $sidebarItem){ if ($sidebarItem->getName() == "Categories") { $secondarySidebar->removeChild($sidebarItem->getName()); } } } } }); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.