markb1439 Posted May 14, 2009 Share Posted May 14, 2009 I just can't for the life of me get this function to work (creating custom pages/templates). The instructions are very brief and vague. Does there exist a tutorial or maybe example files that give more detailed details on how to do this? I understand the basic concept, however I assume every detail has to be right...and the wiki doesn't cover all the nuances. For example, it just says to create a text file and put stuff in it, and that's your template. I'd love to see an example of that file too, in addition to the other example code. Any help would be greatly appreciated. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted May 14, 2009 Share Posted May 14, 2009 Create a new file using your favourite text editor such as notepad, copy and paste the following code into it: Then you change the extension from txt to php and this file goes in your whmcs dir. <?php define("CLIENTAREA",true); require("dbconnect.php"); require("includes/functions.php"); require("includes/clientareafunctions.php"); $pagetitle = $_LANG['clientareatitle']; $pageicon = "images/support/clientarea.gif"; $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a>'; $breadcrumbnav .= ' > <a href="mypage.php">My Page</a>'; initialiseClientArea($pagetitle,$pageicon,$breadcrumbnav); if ($_SESSION['uid']) { # User is Logged In - put any code you like here } # To assign variables in Smarty use the following syntax. # This can then be used as {$variablename} in the template $smartyvalues["variablename"] = $value; # Define the template filename to be used without the .tpl extension $templatefile = "[b]homepage[/b]"; [color=red][b]<< change this to the name of your tpl file.[/b][/color] outputClientArea($templatefile); ?> Now create another text file, this is your template file and will contain the actual content for your custom page. Save this as a tpl file and upload to your templates directory (eg. example.com/whmcs/templates/*TEMPLATE NAME*). <div>this is my new page</div> Then you change the extension from txt to tpl and this file goes in your whmcs/template/portal or default or which ever dir. 0 Quote Link to comment Share on other sites More sharing options...
markb1439 Posted May 14, 2009 Author Share Posted May 14, 2009 Thank you. 0 Quote Link to comment Share on other sites More sharing options...
Bucket Posted May 19, 2009 Share Posted May 19, 2009 How do I add smarty variables to already made pages? Like the pages are encoded so I cant... 0 Quote Link to comment Share on other sites More sharing options...
siforek Posted May 20, 2009 Share Posted May 20, 2009 How do I add smarty variables to already made pages? Like the pages are encoded so I cant... Unfortunately you can't modify the encoded pages, so for those "non-custom" pages you're left to use {php} or exiting smarty variables available to that page. 0 Quote Link to comment Share on other sites More sharing options...
Frankc Posted May 21, 2009 Share Posted May 21, 2009 Still have to do some testing but I encountered a strange problem where "Old" custom pages works in one system with V4 upgrade but not in other system. Above code differ from my old custom page code but even when I tried above I still got errors so .... 0 Quote Link to comment Share on other sites More sharing options...
jrianto Posted May 23, 2009 Share Posted May 23, 2009 Yes, the php files differ in v3.8 or later. You need to use the latest example from WHMCS documentation to add your own php file. Bucket, you can add smarty variables from the template file like this: {php} $myVar = 'dude'; $this->assign('myDudeVar',$myVar); {/php} Now on your template file you can access {$myDudeVar} which contains the string 'dude' Hope that helps 0 Quote Link to comment Share on other sites More sharing options...
kshdzines Posted July 16, 2009 Share Posted July 16, 2009 Ok...this is great...but, there's only one problem I am having with it. I have created a custom page called "Additional Services". I did all I was suppose to and it does link and display: http://www.exquisitehost.com/whmcs/additionalservices.php'>http://www.exquisitehost.com/whmcs/additionalservices.php I Have been sitting here for about 3 hours, reading and reading trying to find out..."now what?". There is no link displaying anywhere for the new page. How do I insert a link for it in the top nav, so the page is still linked through WHMCS? I created an additional service in my "Products", but how do I get the additional services linked to whmcs billing? (was I clear with that??) Maybe I missed something major somewhere? And I need to link a page in the homepage of the site at http://www.exquisitehost.com site. (this I will have no problem with) Grrrr...I'm sorry if I am sounding confusing here, but maybe it is because I am confused. I'm sure all newbies are. Thanks karen 0 Quote Link to comment Share on other sites More sharing options...
siforek Posted July 16, 2009 Share Posted July 16, 2009 Ok...this is great...but, there's only one problem I am having with it. I have created a custom page called "Additional Services". I did all I was suppose to and it does link and display: http://www.exquisitehost.com/whmcs/additionalservices.php'>http://www.exquisitehost.com/whmcs/additionalservices.phpI Have been sitting here for about 3 hours, reading and reading trying to find out..."now what?". There is no link displaying anywhere for the new page. How do I insert a link for it in the top nav, so the page is still linked through WHMCS? I created an additional service in my "Products", but how do I get the additional services linked to whmcs billing? (was I clear with that??) Maybe I missed something major somewhere? And I need to link a page in the homepage of the site at http://www.exquisitehost.com site. (this I will have no problem with) Grrrr...I'm sorry if I am sounding confusing here, but maybe it is because I am confused. I'm sure all newbies are. Thanks karen Rather than pull your hair out over this you could use my blog module to create custom pages on the fly. It also automatically adds the links to your navigation, etc.. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted July 16, 2009 WHMCS Support Manager Share Posted July 16, 2009 You just need to edit header.tpl and add the link. 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted July 17, 2009 Share Posted July 17, 2009 There is no link displaying anywhere for the new page. How do I insert a link for it in the top nav by an edit to the .tpl files - same as everything else try header.tpl in your client-facing theme directory 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.