Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding custom pages to THT
#1
As you can see here, I have added some custom pages to my THT installation. Here's how it's done, in case you're interested.

First, decide what the page will be called. For example's sake, the page will be called "Why us?", and the URL will be "/whyus".

Make a directory in your THT root called "whyus", and touch a file called "index.php". Paste this and save:

PHP Code:
<?php
//////////////////////////////////
// The Hosting Tool
// Order Form
// By Jonny H
// Released under the GNU-GPL
//
// Custom pages by rollthebones
//////////////////////////////////

define("LINK""../includes/");
include(
LINK ."compiler.php");

// Variables
define("PAGE""Why us?"); // What do you want to call this page?
define("SUB""We're different"); // Give this page a subtitle. From what I can tell, this is only used in the <title> tag.
define("INFO""IP Logged: "$_SERVER['REMOTE_ADDR']); // This is shown at the top of the page in small print.

// Sidebar
$c_sidebar_title "Sidebar Title";
$c_sidebar "
<p style=\"padding: 5px;\">
~~ Sidebar content goes here ~~
</p>
"
;

// Main
$c_main_title "Main Box Title";
$c_main "
<p style=\"padding: 5px;\">
~~ Main content goes here ~~
</p>
"
;


// You can ignore everything below this line unless you know what you're doing.

echo $style->get("header.tpl");
$ip $_SERVER['REMOTE_ADDR'];
echo 
'<div id="ajaxwrapper">';
echo 
'<div id="left">';
echo 
$main->table($c_sidebar_title$c_sidebar);
echo 
'</div>';
echo 
'<div id="right">';
echo 
$main->table($c_main_title$c_main);
echo 
'</div>';
echo 
'</div>';
echo 
$style->get("footer.tpl");
include(
LINK ."output.php");
?>

Now go to http://yourhosting.com/tht/whyus - You should get this:

[Image: zItYS.png]

Now, edit these PHP variables to your liking:

define("PAGE", "Why us?"): The title of your page. In <title> and the navbar button
define("SUB", "We're different"): As far as I can tell, this is only used in <title>
define("INFO", "Something else here"): This is shown in small text at the top right of the page.
$c_sidebar_title: The title above the sidebar
$c_sidebar: The content in the sidebar
$c_main_title: The title above the main content box
$c_main: The contents of the main content box

Now, we need to add this page to the navbar! Here's how:

1) Log in to your THT admin
2) Click "Look and Feel" in the sidebar
3) Click "Navbar editor"
4) Click "Add NavBar link"
- Name: Must be the same as "define("PAGE".......", otherwise the tab won't be "selected" when you happen to be on that page.
- Icon: Choose one.
- Link: Should be "whyus" or whatever you named the directory we made earlier

5) Drag it to wherever you want, then save and refresh. If you did everything right, you should be done.

If you want a custom page to be the default page (Like I have), you need to make a database edit. Go into phpMA and open up "tht_config". Find "default" and change "order" to "whyus" (your directory name. If you're doing this, you probably want "home", "welcome", etc).
Reply
#2
Very nice! I like how you extended it when the system itself doesn't make it very easy. Big Grin
Kevin Mark - TheHostingTool Lead Developer
Reply
#3
Thanks Smile

Also, If you want stackable boxes, it can be done with this:

PHP Code:
echo '<div id="left">';
echo 
$main->table($c_sidebar_title$c_sidebar);
echo 
"<br />";
echo 
$main->table($c_sidebar_title_2$c_sidebar_2);
echo 
'</div>'

[Image: PoNb8.png]
Reply
#4
Surely this could made into a plugin that ties dynamically into the ACP?
Jonny H - THT Main Developer & Founder


Reply
#5
(04-18-2010, 05:48 PM)Jonny Wrote: Surely this could made into a plugin that ties dynamically into the ACP?

I don't know enough about THT's innards, or PHP to accomplish that.
Reply
#6
Awesome tutorial! I'm sure that I'll use this, thanks for sharing Big Grin
Regards,
Andraž Rihtar
Reply
#7
why cant i use HTML ???
Reply
#8
Very Nice! might have to use this Smile
Reply
#9
hey, How can I include a php script on that? coz it seems like it only accepts html?
Reply
#10
We need some pre-made pages, Big Grin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)