growe Posted January 30, 2013 Share Posted January 30, 2013 (edited) In the .php file associated with a given page I am able to but this code... $smarty->assign('pagetitle', 'New Page Title'); Doing so resets the value of {$pagetitle} that WHMCS set and changes it to what I would like. I know there are easier ways to do it but it works great when combined with a bunch of if() statements. The page name can be set on the fly. I am currently only using this method for custom pages I have created. My question is this... Where do I put the PHP code for changes I need to make system wide? I now have a need to change some other variables that are not specific to one page. I would like the variable changed system wide. The changes also need to be embedded in if() statements. Example if($criteria=="Something") { $smarty->assign('companyname', 'Company A'); } elseif($criteria=="Something Else") { $smarty->assign('companyname', 'Company B'); } else { $smarty->assign('companyname', 'Company C'); } Where do I put the above code? Edited January 30, 2013 by growe 0 Quote Link to comment Share on other sites More sharing options...
growe Posted January 30, 2013 Author Share Posted January 30, 2013 (edited) I just answered my own question... I created a .php file in /includes/hooks with the following code: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function edit_ClientArea_Variables($vars) { global $smarty; if($criteria=="Something") { $smarty->assign('companyname', 'Company A'); } elseif($criteria=="Something Else") { $smarty->assign('companyname', 'Company B'); } else { $smarty->assign('companyname', 'Company C'); } } add_hook("ClientAreaPage",1,"edit_ClientArea_Variables"); ?> Edited January 30, 2013 by growe 0 Quote Link to comment Share on other sites More sharing options...
growe Posted January 30, 2013 Author Share Posted January 30, 2013 If we had some creative hooks similar to the one above, we could also change the template by using ?systpl= . What would be real slick is a hook that could change the image that the system uses for invoices etc. By changing the company name (as shown in the earlier post in this thread), changing the template (as shown in the above code) and finding away to change the logo in the invoices, etc. It wouldn't be hard to have several virtual companies based on some criteria such as what domain name the user accessed. 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.