Jump to content

Identifying a page: smarty and templating


Recommended Posts

  • 2 months later...

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.

Link to comment
Share on other sites

You can use the $pagename variable also.


{if $pagename eq "Support"}I'm the homepage{/if}


Absolutely, except that it is actually {$pagetitle} :-P


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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.

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