kingmoore Posted August 23, 2006 Share Posted August 23, 2006 How do I create a new page? Let's say I copy over the homepage.tpl file and rename it test_home.tpl and want to access it via test_home.php... Basically I want to add some custom pages to the site but dunno how to do that using the template system, lang files etc... just creating a new TPL file doesn't give me a new page available to link to. 0 Quote Link to comment Share on other sites More sharing options...
MACscr Posted August 23, 2006 Share Posted August 23, 2006 why not just do html files then? Unless you really know smarty, your not going to be able to what you want to do to easily. whmcs is meant to be the support/billing area of your site. its not supposed to run your whole site. 0 Quote Link to comment Share on other sites More sharing options...
kingmoore Posted August 23, 2006 Author Share Posted August 23, 2006 That is an option... I am a developer though and would like to do it within the system if possible for consistancy. 0 Quote Link to comment Share on other sites More sharing options...
MACscr Posted August 23, 2006 Share Posted August 23, 2006 Well, its not an open source script and their is no API, so your out of luck. 0 Quote Link to comment Share on other sites More sharing options...
kingmoore Posted August 23, 2006 Author Share Posted August 23, 2006 Hmmm, so there is no way to add a new template and have it accessable via the web? That's all I needed to know I guess. 0 Quote Link to comment Share on other sites More sharing options...
MACscr Posted August 23, 2006 Share Posted August 23, 2006 There is a way, but it would be horrible dirty. Again, horrible, but you could do what im about to show you, but its pretty stupid and you should just use html templates. First, rename your homepage.tpl file to index.tpl, then make a new file and call it homepage.tpl. Add this code to it: {if $newpage == "YOURNEWPAGENAME"} {include file="YOURNEWPAGENAME.tpl"} {elseif $newpage == "YOURNEWPAGENAME2"} {include file="YOURNEWPAGENAME2.tpl"} {else} {include file="index.tpl"} {/if} you could do this forever. You could turn this into an array as well, but im lazy and didnt feel like doing that for the example. To access the page, the url would be: http://domain.com/WHMCSROOT/index.php?newpage=YOURNEWPAGENAME Again, dirty as hell, but it should work for you. 0 Quote Link to comment Share on other sites More sharing options...
kingmoore Posted August 23, 2006 Author Share Posted August 23, 2006 Thanks for the info. Not really what I'm looking for. Guess we'll just have to have all the header/footer code in multiple locations which is what I was trying to avoid. 0 Quote Link to comment Share on other sites More sharing options...
michelle Posted August 24, 2006 Share Posted August 24, 2006 I was also looking for a way to do this. Glad you brought it up, Kingmoore. MAC: Thanks for the code. Why do you feel it's "dirty"? Is it insecure? Just wondering Michelle 0 Quote Link to comment Share on other sites More sharing options...
MACscr Posted August 25, 2006 Share Posted August 25, 2006 I was also looking for a way to do this. Glad you brought it up, Kingmoore. MAC: Thanks for the code. Why do you feel it's "dirty"? Is it insecure? Just wondering Michelle its not insecure, its just not something i would be proud to use as a "programmer" =P 0 Quote Link to comment Share on other sites More sharing options...
salim72562 Posted July 15, 2011 Share Posted July 15, 2011 How do I create a new page? Let's say I copy over the homepage.tpl file and rename it test_home.tpl and want to access it via test_home.php... Basically I want to add some custom pages to the site but dunno how to do that using the template system, lang files etc... just creating a new TPL file doesn't give me a new page available to link to. Hello sir, Pleasure to help you all, See to create a new page in whmcs, it very easy, do the following steps(sorry for my bad english). Step1: If you need to create a page http://www.yourdomain.com/new.php , say for example, whereas new.php is that new php page you are going to create. So create a new file(new.php) at root directory and add the following data define ('CLIENTAREA', true); require 'dbconnect.php'; require 'includes/functions.php'; require 'includes/clientareafunctions.php'; $pagetitle = "newpage"; $breadcrumbnav = '<a href="new.php">' . $_LANG['globalsystemname'] . '</a>'; $templatefile = 'new'; $pageicon = ''; initialiseclientarea ($pagetitle, $pageicon, $breadcrumbnav); $result = select_query ('tblannouncements', '', array ('published' => 'on'), 'date', 'DESC', '0,3'); while ($data = mysql_fetch_array ($result)) { $id = $data['id']; $date = $data['date']; $title = $data['title']; $announcement = $data['announcement']; $date = frommysqldate ($date); $announcements[] = array ('id' => $id, 'date' => $date, 'title' => $title, 'urlfriendlytitle' => getmodrewritefriendlystring ($title), 'text' => $announcement); } $smartyvalues['announcements'] = $announcements; $smartyvalues['seofriendlyurls'] = $CONFIG['SEOFriendlyUrls']; outputclientarea ($templatefile); ?> and save the file. (copy fully inorder to get data from database in your new page) Step2: Goto templates->(yourtemplatename) There create a file "new.tpl" , and enter your HTML code. note: enter only the code within <body></body> tags. step3: ggive this in your address bar http://www.yourdomain.com/new.php , now you will see your new page,. [ change the keywork "new" to ur pagename wherever u want] Enjoy. very simple. 0 Quote Link to comment Share on other sites More sharing options...
salim72562 Posted July 15, 2011 Share Posted July 15, 2011 How do I create a new page? Let's say I copy over the homepage.tpl file and rename it test_home.tpl and want to access it via test_home.php... Basically I want to add some custom pages to the site but dunno how to do that using the template system, lang files etc... just creating a new TPL file doesn't give me a new page available to link to. Hello sir, Pleasure to help you all, See to create a new page in whmcs, it very easy, do the following steps(sorry for my bad english). Step1: If you need to create a page http://www.yourdomain.com/new.php , say for example, whereas new.php is that new php page you are going to create. So create a new file(new.php) at root directory and add the following data define ('CLIENTAREA', true); require 'dbconnect.php'; require 'includes/functions.php'; require 'includes/clientareafunctions.php'; $pagetitle = "newpage"; $breadcrumbnav = '<a href="new.php">' . $_LANG['globalsystemname'] . '</a>'; $templatefile = 'new'; $pageicon = ''; initialiseclientarea ($pagetitle, $pageicon, $breadcrumbnav); $result = select_query ('tblannouncements', '', array ('published' => 'on'), 'date', 'DESC', '0,3'); while ($data = mysql_fetch_array ($result)) { $id = $data['id']; $date = $data['date']; $title = $data['title']; $announcement = $data['announcement']; $date = frommysqldate ($date); $announcements[] = array ('id' => $id, 'date' => $date, 'title' => $title, 'urlfriendlytitle' => getmodrewritefriendlystring ($title), 'text' => $announcement); } $smartyvalues['announcements'] = $announcements; $smartyvalues['seofriendlyurls'] = $CONFIG['SEOFriendlyUrls']; outputclientarea ($templatefile); ?> and save the file. (copy fully inorder to get data from database in your new page) Step2: Goto templates->(yourtemplatename) There create a file "new.tpl" , and enter your HTML code. note: enter only the code within <body></body> tags. step3: Give this in your address bar http://www.yourdomain.com/new.php , now you will see your new page,. [ change the keywork "new" to ur pagename wherever u want] Enjoy. very simple. 0 Quote Link to comment Share on other sites More sharing options...
TemposYS Posted July 7, 2012 Share Posted July 7, 2012 http://docs.whmcs.com/Creating_Pages try this 0 Quote Link to comment Share on other sites More sharing options...
komir Posted December 16, 2013 Share Posted December 16, 2013 Hello sir, Pleasure to help you all, See to create a new page in whmcs, it very easy, do the following steps(sorry for my bad english). Step1: If you need to create a page http://www.yourdomain.com/new.php , say for example, whereas new.php is that new php page you are going to create. So create a new file(new.php) at root directory and add the following data define ('CLIENTAREA', true); require 'dbconnect.php'; require 'includes/functions.php'; require 'includes/clientareafunctions.php'; $pagetitle = "newpage"; $breadcrumbnav = '<a href="new.php">' . $_LANG['globalsystemname'] . '</a>'; $templatefile = 'new'; $pageicon = ''; initialiseclientarea ($pagetitle, $pageicon, $breadcrumbnav); $result = select_query ('tblannouncements', '', array ('published' => 'on'), 'date', 'DESC', '0,3'); while ($data = mysql_fetch_array ($result)) { $id = $data['id']; $date = $data['date']; $title = $data['title']; $announcement = $data['announcement']; $date = frommysqldate ($date); $announcements[] = array ('id' => $id, 'date' => $date, 'title' => $title, 'urlfriendlytitle' => getmodrewritefriendlystring ($title), 'text' => $announcement); } $smartyvalues['announcements'] = $announcements; $smartyvalues['seofriendlyurls'] = $CONFIG['SEOFriendlyUrls']; outputclientarea ($templatefile); ?> and save the file. (copy fully inorder to get data from database in your new page) Step2: Goto templates->(yourtemplatename) There create a file "new.tpl" , and enter your HTML code. note: enter only the code within <body></body> tags. step3: Give this in your address bar http://www.yourdomain.com/new.php , now you will see your new page,. [ change the keywork "new" to ur pagename wherever u want] Enjoy. very simple. Is it possible to every user have different data on that custom page? I want to add piwik widget iframe, different for every user. Best regards 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.