Jump to content

Creating Custom Pages


Recommended Posts

I just can't for the life of me get this function to work (creating custom pages/templates). The instructions are very brief and vague. Does there exist a tutorial or maybe example files that give more detailed details on how to do this?

 

I understand the basic concept, however I assume every detail has to be right...and the wiki doesn't cover all the nuances. For example, it just says to create a text file and put stuff in it, and that's your template. I'd love to see an example of that file too, in addition to the other example code.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

Create a new file using your favourite text editor such as notepad, copy and paste the following code into it:

 

Then you change the extension from txt to php and this file goes in your whmcs dir.

 

<?php

define("CLIENTAREA",true);

require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");

$pagetitle = $_LANG['clientareatitle'];
$pageicon = "images/support/clientarea.gif";
$breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a>';
$breadcrumbnav .= ' > <a href="mypage.php">My Page</a>'; 

initialiseClientArea($pagetitle,$pageicon,$breadcrumbnav);

if ($_SESSION['uid']) {
 # User is Logged In - put any code you like here
} 

# To assign variables in Smarty use the following syntax.
# This can then be used as {$variablename} in the template

$smartyvalues["variablename"] = $value; 

# Define the template filename to be used without the .tpl extension

$templatefile = "[b]homepage[/b]";  [color=red][b]<< change this to the name of your tpl file.[/b][/color]

outputClientArea($templatefile);

?>

 

Now create another text file, this is your template file and will contain the actual content for your custom page. Save this as a tpl file and upload to your templates directory (eg. example.com/whmcs/templates/*TEMPLATE NAME*).

 

<div>this is my new page</div>

 

 

Then you change the extension from txt to tpl and this file goes in your whmcs/template/portal or default or which ever dir.

Link to comment
Share on other sites

How do I add smarty variables to already made pages?

 

Like the pages are encoded so I cant...

 

Unfortunately you can't modify the encoded pages, so for those "non-custom" pages you're left to use {php} or exiting smarty variables available to that page.

Link to comment
Share on other sites

Still have to do some testing but I encountered a strange problem where "Old" custom pages works in one system with V4 upgrade but not in other system.

 

Above code differ from my old custom page code but even when I tried above I still got errors so ....

Link to comment
Share on other sites

Yes, the php files differ in v3.8 or later. You need to use the latest example from WHMCS documentation to add your own php file.

 

Bucket, you can add smarty variables from the template file like this:

 

{php}

$myVar = 'dude';

$this->assign('myDudeVar',$myVar);

{/php}

 

Now on your template file you can access {$myDudeVar} which contains the string 'dude'

 

Hope that helps

Link to comment
Share on other sites

  • 1 month later...

Ok...this is great...but, there's only one problem I am having with it. I have created a custom page called "Additional Services". I did all I was suppose to and it does link and display: http://www.exquisitehost.com/whmcs/additionalservices.php'>http://www.exquisitehost.com/whmcs/additionalservices.php

I Have been sitting here for about 3 hours, reading and reading trying to find out..."now what?". There is no link displaying anywhere for the new page. How do I insert a link for it in the top nav, so the page is still linked through WHMCS? I created an additional service in my "Products", but how do I get the additional services linked to whmcs billing? (was I clear with that??) Maybe I missed something major somewhere?

And I need to link a page in the homepage of the site at http://www.exquisitehost.com site. (this I will have no problem with) Grrrr...I'm sorry if I am sounding confusing here, but maybe it is because I am confused. I'm sure all newbies are.

 

Thanks

karen

Link to comment
Share on other sites

Ok...this is great...but, there's only one problem I am having with it. I have created a custom page called "Additional Services". I did all I was suppose to and it does link and display: http://www.exquisitehost.com/whmcs/additionalservices.php'>http://www.exquisitehost.com/whmcs/additionalservices.php

I Have been sitting here for about 3 hours, reading and reading trying to find out..."now what?". There is no link displaying anywhere for the new page. How do I insert a link for it in the top nav, so the page is still linked through WHMCS? I created an additional service in my "Products", but how do I get the additional services linked to whmcs billing? (was I clear with that??) Maybe I missed something major somewhere?

And I need to link a page in the homepage of the site at http://www.exquisitehost.com site. (this I will have no problem with) Grrrr...I'm sorry if I am sounding confusing here, but maybe it is because I am confused. I'm sure all newbies are.

 

Thanks

karen

 

Rather than pull your hair out over this you could use my blog module to create custom pages on the fly. It also automatically adds the links to your navigation, etc..

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