Results 1 to 13 of 13

Thread: Create a new page?

  1. #1
    Join Date
    Aug 2006
    Posts
    49

    Default Create a new page?

    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.

  2. #2
    Join Date
    May 2006
    Posts
    2,546

    Default

    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.

  3. #3
    Join Date
    Aug 2006
    Posts
    49

    Default

    That is an option... I am a developer though and would like to do it within the system if possible for consistancy.

  4. #4
    Join Date
    May 2006
    Posts
    2,546

    Default

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

  5. #5
    Join Date
    Aug 2006
    Posts
    49

    Default

    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.

  6. #6
    Join Date
    May 2006
    Posts
    2,546

    Default

    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:

    Code:
    {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:

    Code:
    http://domain.com/WHMCSROOT/index.php?newpage=YOURNEWPAGENAME
    Again, dirty as hell, but it should work for you.

  7. #7
    Join Date
    Aug 2006
    Posts
    49

    Default

    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.

  8. #8
    Join Date
    Aug 2006
    Posts
    176

    Default

    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

  9. #9
    Join Date
    May 2006
    Posts
    2,546

    Default

    Quote Originally Posted by michelle
    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

  10. #10
    Join Date
    Jul 2011
    Posts
    2

    Thumbs up To create a new page in whmcs

    Quote Originally Posted by kingmoore View Post
    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.

  11. #11
    Join Date
    Jul 2011
    Posts
    2

    Thumbs up To create a new page in whmcs

    Quote Originally Posted by kingmoore View Post
    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.

  12. #12
    Join Date
    Jun 2012
    Posts
    2

  13. #13
    Join Date
    Jul 2013
    Posts
    3

    Default Re: To create a new page in whmcs

    Quote Originally Posted by salim72562 View Post
    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

Similar Threads

  1. How to create a custom page?
    By neobug103 in forum Customisation and Integration Questions
    Replies: 1
    Last Post: 03-31-10, 01:17 PM
  2. Create a Page
    By Daniel in forum Customisation and Integration Questions
    Replies: 0
    Last Post: 06-09-08, 02:56 PM
iron-diatonic