PDA

View Full Version : Create a new page?



kingmoore
08-23-06, 08:25 PM
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.

MACscr
08-23-06, 08:39 PM
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.

kingmoore
08-23-06, 08:40 PM
That is an option... I am a developer though and would like to do it within the system if possible for consistancy.

MACscr
08-23-06, 08:42 PM
Well, its not an open source script and their is no API, so your out of luck.

kingmoore
08-23-06, 08:55 PM
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.

MACscr
08-23-06, 09:20 PM
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.

kingmoore
08-23-06, 09:39 PM
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.

michelle
08-24-06, 11:00 PM
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

MACscr
08-25-06, 12:26 AM
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

salim72562
07-15-11, 02:53 PM
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.:lol:

salim72562
07-15-11, 02:55 PM
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.:lol:

TemposYS
07-07-12, 02:06 PM
http://docs.whmcs.com/Creating_Pages
try this