Jump to content

Creating Pages


selym

Recommended Posts

Hello,

 

I would like to create two new pages with WHMCS since my site copy/content will fit on two pages, it makes more sense to build my site around WHMCS and keep everything looking similar.

 

I found this page (http://wiki.whmcs.com/Creating_Pages) but I'm not exactly sure what to do with the code. I created a new file and pasted that code into it, but that didn't work.

 

Can anyone explain exactly how to create a new page, or perhaps point me in the right direction please? Thank you very much.

 

Selym

Link to comment
Share on other sites

OK here goes

 

1. First create a new file using your favourite text editor and copy and paste the following code into it as it says in the wiki:

<?php

define("CLIENTAREA",true);
require("dbconnect.php");
require("includes/functions.php"); 

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

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

# Define the template filename to be used without the .tpl extension
$templatefile = "homepage"; 

# To assign variables in Smarty use the following syntax. This can then be used as {$variablename} in the template
$smartyvalues["variablename"] = $value; 

require("display.php"); 

?>

Now edit the variables on that page

 

$pageicon - To change the icon image on the right side top of the content area

$breadcrumbnav - Change the link at the end of the line to suit your new page.

 

$templatefile - Change the name in between the quotes to the name of your template file. (without the .tpl extension)

 

$smartyvalues - As the description above it says

 

Save the file to what your new page is called (don't use the same name as the existing files) and upload to the WHMCS root directory.

 

Almost done

 

2. Create another new file using your favourite text editor and paste your code into it.

 

Then save that file into your theme directory that you are using as the same name you typed into the $templatefile variable with .tpl at the end.

 

Thats it...

Hope that helped

Link to comment
Share on other sites

Thank you Chicken and Sparky for taking the time to help.

 

Still having a bit of trouble getting anything to show up.

 

Here's what I did referring to both of your instructions.

 

-Created new.php, pasted the code into it, and made sure file was in whmcs root directory, which is actually "whmcs" for this test.

 

-Changed this line: $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a> > <a href="mypage.php">My Page</a>';

require("init.php");

 

To this: $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a> > <a href="new.php">New Page</a>';

require("init.php");

 

Then changed this line:

$templatefile = "homepage";

 

To this:

$templatefile = "new";

 

I saved the file, then copied the code and pasted it into a new file called new.tpl, saved it, and then uploaded it to whmcs/templates/portal, then browswed to mydomain.com/whmcs/new.php

 

Still no luck getting a blank shell to show up. Do you see anything I've done wrong, or perhaps I missed something simple? I'm obviously not a programmer, but I hope I can crawl my way through this with your guidance.

 

Thanks again to both of you for helping.

 

 

Selym

Link to comment
Share on other sites

Originally I used notepad, but I also copied another existing page and renamed it to try that as well. Neither worked. Should I be using a specific program to create these files?

 

Have PM'd you the url of my test site.

 

 

 

Thanks,

 

Selym

 

 

 

 

What are you using to create the file (What Program)?

 

What is your url to your site?

Link to comment
Share on other sites

Ahhh... I see what you have done wrong

 

You created the new.php in WHMCS directory OK

Then you created the new.tpl file, put it in the correct template directory - OK so far

Then you pasted the same php code in new.tpl - this is were you went wrong

 

In new.tpl goes your page content (html tags, text, images and stuff)

 

Remove the contents of new.tpl and just type in

<div style="text-align:center;font-size:20px;font-weight: bold;">Hello World.</div>

Then save it.

Link to comment
Share on other sites

Ahh, ok, I just did what you said and the text is now showing up. Thanks for your help Steve.

 

So perhaps I misunderstood what the "create a page" function does. I thought it would give me sort of an empty shell of a page in which I would have the navigation menu, header, footer, etc., which I could then add my own content to...but it would still look like a page that "belonged". Did I get the wrong idea, or is there still much to be done with this new page? :)

 

 

 

 

Ahhh... I see what you have done wrong

 

You created the new.php in WHMCS directory OK

Then you created the new.tpl file, put it in the correct template directory - OK so far

Then you pasted the same php code in new.tpl - this is were you went wrong

 

In new.tpl goes your page content (html tags, text, images and stuff)

 

Remove the contents of new.tpl and just type in

<div style="text-align:center;font-size:20px;font-weight: bold;">Hello World.</div>

Then save it.

Link to comment
Share on other sites

Hi chickendippers-

 

Forgive me for not understanding completely, but do you mean type MY custom content into the tpl file, or the content/code such as the menu, header, footer, etc.? I'm just wondering at what point the "shell" is supposed to appear, because right now all I have is text (two words) from the steps I did above from Steve.

 

 

 

Thanks,

 

Selym

 

 

 

That's exactly what it does, so just type the content into the tpl file!
Link to comment
Share on other sites

Your page that displays is basicly in 3 sections

 

HEADER SECTION - displayed from header.tpl

CONTENT SECTION - displayed in your example by new.tpl

FOOTER SECTION - displayed from footer.tpl

 

So yes your custom content goes into new.tpl

Link to comment
Share on other sites

Okay, I started thinking I was beyond help because even after your last posts all I saw was the text, and none of the menus, header, footer, nothing. But then I realized my mistake. Somehow....I had the code swapped...what should have been in the php file was in the tpl file, and vice versa. So all is well now.

 

Thank you both for helping. Very kind of you to help out. :)

Link to comment
Share on other sites

  • 11 months later...
  • 2 months later...

Hello!

 

I ask the help!

I have created page and it was created normally.

 

Now I wish to make processing of a code in PHP a file and result to give out in a variable for display in a pattern.

I try to use a design $smartyvalues["variablename"] = "zzzz ';

But at me nothing turns out......

How to me to catch a variable in TPL a file?

 

And still a problem...

$pageicon = "images/support/clientarea.gif"; - does not work.

The picture does not show....

 

I used different ways, have read through a forum but have not found the answer!!

 

There were changes for version 4.1.1??

And they are not described in the documentation?

 

Thanks in advance!

Link to comment
Share on other sites

I try to use a design $smartyvalues["variablename"] = "zzzz ';

But at me nothing turns out......

How to me to catch a variable in TPL a file?

using your example above you will need to put {$variablename} into your tpl file for it to display.

And still a problem...

$pageicon = "images/support/clientarea.gif"; - does not work.

The picture does not show....

The image is no longer in that directory... try this

$pageicon = "images/clientarea.gif";

Link to comment
Share on other sites

  • 1 month later...

i cant get the new page to show up. i am just getting a blank page.

 

here is my sharedhosting.php file, saved in whmcs root

<?php

 

define("CLIENTAREA",true);

require("dbconnect.php");

require("includes/functions.php");

 

$pagetitle = $_LANG['clientareatitle'];

$pageicon = "images/support/clientarea.gif";

$breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a> > <a href="sharedhosting.php">Shared Hosting</a>';

require("init.php");

 

if ($_SESSION['uid']) {

# User is Logged In - put any code you like here

}

 

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

$templatefile = "sharedhosting";

 

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

$smartyvalues["variablename"] = $value;

 

require("display.php");

 

?>

 

and here is my sharedhosting.tpl saved in /templates/portal/

<div style="text-align:center;font-size:20px;font-weight: bold;">TEST TEST</div>

 

can anyone tell me what i am doing wrong

Link to comment
Share on other sites

  • 4 months later...

Please sparky I need your help my WHMCS link is http://www.hostandeye.com/whmcs'>http://www.hostandeye.com/whmcs please i need to know how to add links inside the portal home to take me back to my website http://www.hostandeye.com please i can't do it myself i am very upset i tried for 15 days to do that and I couldn't help me please or make it for me if you can

Link to comment
Share on other sites

Please sparky I need your help my WHMCS link is http://www.hostandeye.com/whmcs'>http://www.hostandeye.com/whmcs please i need to know how to add links inside the portal home to take me back to my website http://www.hostandeye.com please i can't do it myself i am very upset i tried for 15 days to do that and I couldn't help me please or make it for me if you can

There are lots of others that can help you just as well as what I can.

As rob3369 posted that will work by using relative urls

/ being relative to your public_html directory

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