kurbot Posted March 3, 2009 Share Posted March 3, 2009 Im trying to add some new pages, and i would like to add them into the current system so that i can include the already built header and footer.. The problem im running into is im not sure, how to call the language file for labels or im not sure how to include the header and footer files so that they will display corrected with whmcs variables being passed in PHP.. Any insight would be very helpful, all im trying to do is keep the page structure consistant, and make it so that its easy to update in the future instead of having to redo multiple pages when the do the same thing.. Pages im trying to add are about us, employement opportunities, and some quick pages for whm cpanel and webmail login access.. I have all my pages already built in smarty, simply just trying to add the header and footer from the current WHMCS.. Let me know 0 Quote Link to comment Share on other sites More sharing options...
kurbot Posted March 3, 2009 Author Share Posted March 3, 2009 N/m I found the Wiki on how to add pages.. Thanks 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 3, 2009 Share Posted March 3, 2009 Lets do an example for your "About Us" page You need to create 2 files aboutus.php (to go into your whmcs root folder) aboutus.tpl (contains your content and goes in your templates folder) aboutus.php <?php define("CLIENTAREA",true); require("dbconnect.php"); require("includes/functions.php"); if ($CONFIG['Version'] >= "3.8.1") {require("includes/clientareafunctions.php");} $pagetitle = "About Us"; $pageicon = "images/supporttickets_big.gif"; $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a> > <a href="aboutus.php">About Us</a>'; if ($CONFIG['Version'] >= "3.8.1") {initialiseClientArea($pagetitle,$pageicon,$breadcrumbnav);} else {require("init.php");} # Insert your custom variables here if needed # Define the template filename to be used without the .tpl extension $templatefile = "aboutus"; if ($CONFIG['Version'] >= "3.8.1") {outputClientArea($templatefile);} else {require("display.php");} ?> Simply change the variables to suit your custom page $pagetitle - This is the title of your page. $pageicon - This is the icon that you want displayed. $breadcrumbnav - This is the breadcrumb link. $templatefile - This is the name of your template file (without the extension) Custom Variables - eg.. $smartyvalues["your_variable_name"] = "Fred";This variable in your template is inserted as {$your_variable_name} and will show on the output of the page as Fred. As you can see the code above will work for older versions of WHMCS as well as the new format that changed in V3.8.1 aboutus.tpl For the template file simply create a new text file insert the text and html code that you want the page to show and name the file as you defined in the php file but this time with the tpl extension. Hope that is what you were looking for. EDIT: looks like I was too late.. (I took too long in writing this) 0 Quote Link to comment Share on other sites More sharing options...
kurbot Posted March 3, 2009 Author Share Posted March 3, 2009 Thanks for the reply, yes i wasnt aware of the wiki article.. and i found it literally 5 minutes after i posted. 0 Quote Link to comment Share on other sites More sharing options...
kurbot Posted March 4, 2009 Author Share Posted March 4, 2009 Follow up question to this message though.. Im trying to get a database query on one of my custom pages which i have successfully performed, however im having a heck of a time getting the ojbects over to smarty for looping. if i print_r the array i get this. Array ( [0] => stdClass Object ( [id] => 28 [type] => hostingaccount [gid] => 21 [name] => Custom Hosting [description] => .......................... [1] => stdClass Object ( [id] => 29 [type] => hostingaccount [gid] => 21 [name] => Custom Hosting [description] => .......................... [2] => stdClass Object ( [id] => 30 [type] => hostingaccount [gid] => 21 [name] => Custom Hosting [description] => .......................... ETC My question is how do i get the Object class into a smarty section or foreach array/loop Any insight would be awsome.. 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted March 6, 2009 Share Posted March 6, 2009 It works the same way as a regular array, but you use the standard object notation. $array_of_objects = get_some_objects_however_you_want(); $this->assign('object_array', $array_of_objects); {foreach from=$object_array item=object} {$object->member} {/foreach} The same also applies to sections as well. 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.