Jump to content
Sign in to follow this  
kingmoore

Create a new page?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Well, its not an open source script and their is no API, so your out of luck.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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:

Share this post


Link to post
Share on other sites
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:

Share this post


Link to post
Share on other sites
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:

 

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines