velocity Posted November 5, 2007 Share Posted November 5, 2007 Hi, I'd like to append a css class to menu items depending on which page I'm on. Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
velocity Posted January 24, 2008 Author Share Posted January 24, 2008 Been a while since I posted this, so still no ideas anyone? 0 Quote Link to comment Share on other sites More sharing options...
allynne Posted January 24, 2008 Share Posted January 24, 2008 In your header.tpl file you could add another line to load the additional CSS file based on the scriptname (the only way I can see of deducing which page you are on) with the following line <link rel="stylesheet" type="text/css" href="templates/default2{$SCRIPT_NAME}.css" media="screen,projection" /> and then name you additional CSS file something like clientarea.php.css By having it as an additional CSS file means you don't have to include everything in your new CSS file ... just the bits you want changed. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS CEO Matt Posted January 24, 2008 WHMCS CEO Share Posted January 24, 2008 You can use the $pagename variable also. {if $pagename eq "Support"}I'm the homepage{/if} Matt 0 Quote Link to comment Share on other sites More sharing options...
allynne Posted January 24, 2008 Share Posted January 24, 2008 You can use the $pagename variable also. {if $pagename eq "Support"}I'm the homepage{/if} Matt Absolutely, except that it is actually {$pagetitle} The reason I suggested ($SCRIPT_NAME} is that it will always be a valid filename which means you wouldn't have to worry about the logic statements. 0 Quote Link to comment Share on other sites More sharing options...
velocity Posted January 25, 2008 Author Share Posted January 25, 2008 Ah it seems as though I wasn't specific enough in my original post. I want to ID the client area menu: Client Area Home, My Details, My Invoices... etc. Neither of those variables output anything on these pages that can be used as a unique ID. I.e. (for most of the pages) {$SCRIPT_NAME} = /clients/clientarea.php {$pagetitle} = Client Area 0 Quote Link to comment Share on other sites More sharing options...
allynne Posted January 25, 2008 Share Posted January 25, 2008 So what would happen if you loaded the new CSS file from within the specific template? I know that CSS files 'should' be loaded from the <HEAD>, but loading them inside the <BODY> does actually work. Perhaps this will be a work-around for you. 0 Quote Link to comment Share on other sites More sharing options...
velocity Posted January 25, 2008 Author Share Posted January 25, 2008 Hmm... I see what you mean. I would assign this "absolute last resort" status to be honest. It's less than elegant, but I appreciate your input. I'm thinking at the moment that one way would be to use PHP to get hold of ?action= on the end of url for each client area page. But I don't know how to do this. 0 Quote Link to comment Share on other sites More sharing options...
Jordan Posted January 25, 2008 Share Posted January 25, 2008 I actually have this working on mywhmcs.com. Though how I did this was I used .htaccess to rewrite the URLs and then added in a PHP variable to control the menu, so that it would be dynamic when the user is on that page. I only did that method because of the way that ?action= worked, when a user was on a "sub page" of clientarea, the menu would only highlight the client area submenu, and not the actual sub page itself. 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.