Jump to content

Create a new page?


kingmoore

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.

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

  • 4 years later...
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:

Link to comment
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:

Link to comment
Share on other sites

  • 11 months later...
  • 1 year later...
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated