View Full Version : How To New Pages in vb style
Ok ive seen that alot of people have been asking how to create new pages with the vbulletin style on them like i have used on forum.imaedia.com for the link/games etc pages, so ive decided to write this to tell everyone how to do it
Ok i usualy start by creating a basic template in the admin cp that i will use for all the pages that im going to add.
log into your admin cp go to styles and templates then go to the style manager and expand the style that you are currently using on the right of the page you will see a drop down menu, select add new template from it and then you need to name it
for this example im naming mine : "test"
now we need to create a very basic html template to go in this template:
because im doing this quickly i just added any css i wanted to use onto this page instad of using the vbulletin css styles
ok so put the following into your temoplate and change the parts that say page name and page content to suit your needs :)
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
save the template.
The next step is to create the php file that will call the template,
Here is the code i used, to incldue the naviation and header/footer
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
rite now save that as a .php file, and upload it into your vbulletin root directory
then go to yourforumurl/pagename.php and you got yourself a non vb page with vb template on it
hope that helps post any questions, i prolli missed something or done something totaly wrong but hehe just trying to help :P
Ryan Ashbrook
03 Mar 2004, 20:16
Nice job, but I don't like the way you coded the PHP file, looks like you just threw it in there, un-organized so to speak.
But still good job. ^_^
replace TEMPLATENAME with your template's name :) (it's 2 times on this file)
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
yea thats better hehe, alot nicer organised
That's why i posted it ;)
Kier and his team made an amazing job in commenting all the functions and stuff you can find in that files so let's honor that work and use their comments :)
yea.....ill put that code into the first post aswell :)
Ryan Ashbrook
04 Mar 2004, 20:20
Now that is better! :) Nice job!
thanks, and thanks to MrNase too :)
hollyboy
12 May 2004, 17:24
white page seeing this
http://www.interfans.org/forum/rules.php
some of my members don't see this page. They get a white page.
Why?
Thanks .. I really like this and have started using it!! :)
glad you like it
http://www.interfans.org/forum/rules.php
some of my members don't see this page. They get a white page.
Why?
It works fine for me, so i have no idea, sorry
Arcanum
13 May 2004, 12:16
Okay but what about coding a .php file to handle more than 1 template?
Ryan Ashbrook
13 May 2004, 13:56
white page seeing this
http://www.interfans.org/forum/rules.php
some of my members don't see this page. They get a white page.
Why?
The template must be made on all styles. Your members who see a white are using a style without the template in it.
Hi, i dont everything correctly and still i cannot see the page :S it comes up white....
can someone help please.
/moley
Beermonster
23 Aug 2004, 11:08
This looks like the same hack Livewire released on his forum :confused:
benj.w00t
23 Sep 2004, 12:21
how would i go about calling a post on a vbulletin powered page in the template ???
benj.w00t
27 Sep 2004, 12:02
any 1 *bump*
StevenIsProek
10 Oct 2004, 08:17
thanks works
Mokster
25 Nov 2004, 02:02
thanks! very helpful!!!
Mokster
28 Nov 2004, 04:04
actually i am having a problem, only users that are logged in are able to see this page, guests see a white screen with some text... see for yourself :/ http://www.torontogolfnuts.com/links.php
says:
Unable to add cookies, header already sent.
File: /home2/golfnuts/public_html/links.php
Line: 1
Mokster
29 Nov 2004, 19:57
bump :)
Thanks a bunch.
I did EVERYTHING you said to do, but I get this
roster2.php (http://rec0n.nauticaltech.com/forums/roster2.php)
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Output in IE:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The PHP file is located in my /forums/ directory. Is that a problem? I am trying to get a page that I can use HTML on and update about once every week that is linked from my VB Index on VB 3.0.0 RC4. I want all the VB Index stuff surrounding it, but have where normally is news to be a clan roster.
I eventually want to have multipul styles so I don't want to half-*** it.
I attached an image of what i'm trying to do. There might be an easier way. And no, I don't want to have a forum for each page and post the roster in a forum and have VB Index read it. I want to fully HTML whats inside each block (eg. block= roster)
The problem:
roster2.php (http://rec0n.nauticaltech.com/forums/roster2.php)
Ok, I got it working now. I copied it wrong. I edited it and it worked. Looks great!
Is there an easy way to get all the VB Index stuff on the side of the pages?
GetGamer.com
29 Dec 2004, 21:18
Is there a way to store my custom .php page in a non-forum directory?
I don't think so considering all vBulletin data is read within the main directory.
Motoscene
08 Feb 2005, 05:07
I am getting a white page as well. Not sure what I did wrong. I copyed and pasted everything you typed and changed the TEMPLATE NAME to the correct template I have added. Also I created a php file as well. Do I need to change anything else besides TEMPLATE NAME to make this work. Sorry I am very new at this. But edger to learn it. Thanks, Chain
Is there a way to store my custom .php page in a non-forum directory?
yes.. add
chdir('/server/path/to/forum/directory');
after
define('THIS_SCRIPT', 'yourscript');
in the php file.
Motoscene
09 Feb 2005, 07:34
Well I am still having problems with this wo if anyone could help me out that would be great. I go ahead and tell you the way I uploaded it to my site.
First made the template (rules) in my styles. Also when I did that it placed it under custom templates. I sure that is right but one thing is that it is the only templete that looks tabed out????
Rules Template
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
And here is the php file that I made with notepad:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
you don't mention what the problems are.
Motoscene
09 Feb 2005, 18:53
oh sorry the problem is that I still get a white page like the others were getting. I not sure if I did all the code correctly.
Motoscene
11 Feb 2005, 03:54
Nevermind I don't know what I did but I got it to work. And thanks very much for showing me how to do this. I like this "how to". Thanks
Insert Username
18 Jan 2007, 21:36
Nothing like bumping a very old topic...
I've used this tutorial to create a page, and for the most part, it's working. But this part:
define('THIS_SCRIPT', 'yourscript');
What does 'yourscript' refer to? I'm not sure what to replace there.
jbrohan
20 Jan 2007, 16:30
Hello just feeling my way too...
I havce an insight and a question...
There are two places in the .php program where you must put the name of your script. If the .php program is calles say "wunderbar.php" then near the top of the program is define('THIS_SCRIPT', 'wunderbar');// note no .php
towards the end of the program you need
eval('print_output("' . fetch_template('wunderbar') . '");');
In my case the template is called wunderbar too so that things work.
My question.
I'd like to know the user name in the program wunderbar.php. I've jsut got it working a little.
I have a post with a link to my-forum/wunderbar.php If I click on the link it executes wunderbar.php. wunderbar.php calls the template script wuinderbar. I need some way to get the username in here.
I'd really like to put some dynamic content into the template script. Or perhaps have two templates, a top and a tail, and I'll put in the dynamic content in wunderbar.php.
John
Is there an updated version for 3.6.x ?
Ok I'm stumped
I have put in the php file betaform.php
http://askatech.autorepairdata.com/betaform.php
Modified the base template
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
I even installed the supplied template with no modifications.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
And all I get is the white screen of death. I only use the default style on my board. Any help would be great. I really need this to work.
Opserty
19 Jan 2008, 15:18
You need to include global.php from your forum directory...
Change:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
To:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
You need to include global.php from your forum directory...
Change:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
To:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
I have tried his the way I understand it, but maybe I am getting this wrong so I will throw in more info. I have been able to get the test pages to work and several live pages that live in the forum folder. But now I really need to put a php page in another folder.
Here is my folderstructure.
/rootfolder/forum
I want a php file to work in
/rootfolder/anotherfolder
So here is the code I am trying to use in my php file in /rootfolder/anotherfolder
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Can anyone spot a typo or syntax error.
Thanks if you can help.
BTW, I have dropped a straight HTML file in /rootfolder/anotherfolder and that works fine. The php files gives me a white screen and when I view the source all I see are the default html structure tags.
Opserty
27 Feb 2008, 15:43
Try:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Notice the two dots, else try:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
petteyg359
28 Feb 2008, 16:46
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
In your template, you then put
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
You can use whatever you want to in your template, but these will at least give you a working start and shows where your code should actually be placed. If your post was the actual code you were using, seems like you had a few things out of order. You don't necessarily need anything at all in the "YOUR PHP CODE" section if you don't want to set any custom data, but you need the rest of the file.
If the code you posted is what you're actually using, you need to change the DEFINE 'yourscript' to the name of the PHP file, minus the .php extension.
Never2Day
29 Feb 2008, 16:47
I have no idea how to do this sorry I have managed to do the first part but the second code i have no idea what to do with where to put it or what i should do cause when i did put it onto a blank page i got errors.
Bilderback
01 Mar 2008, 19:03
Okay but what about coding a .php file to handle more than 1 template?
In order to use a single php file for multiple templates, you would use url variations using $_GET.
If your main page was information.php you would have to write multiple request methods such as:
information.php?do=main
information.php?do=contact
information.php?do=about
You would create your templates and put them all into the $globaltemplates array() like
$globaltemplates = array(
'main',
'contact',
'about'
);
When working with multiple templates, I do advise to use some prefix such as info_ or something.
Then you setup your php file to handle the requests.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Its a bit complex and hard for me to explain in a spur of the moment forum post,
but basically, you have to handle the code for your different url requests, then
write the different eval() to fetch the templates within those requests.
I suggest looking into the code of a product that uses multiple urls to get a better understanding.
******************************
I have no idea how to do this sorry I have managed to do the first part but the second code i have no idea what to do with where to put it or what i should do cause when i did put it onto a blank page i got errors.
Your created template may contain anything you wish, even if its a simple <b>Welcome</b>
But, if you want it to be contained within your forum layout, there are several variables you must call such as $headinclude,$header,$navbar and $footer
This places your content within the vbulletin page.
Simply by pasting the code provided into a new template should work for you.
As far as the PHP file, there are really only two areas you need to edit.
These areas MUST conform to the template name you just created.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
and
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Lets say you create a template named aboutme
You would edit the supplied php code in this thread to:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
and
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
within the php file.
Save the file as aboutme.php and upload to your forum root so when people
visit www.yoursite.com/forum/aboutme.php
it will display the contents of the template you created.
If you need assistance with a simple page, contact me.
I'd like to add that sometimes the forumjump menu does not work on pages
in which case you need to add
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
above eval('$navbar = "' . fetch_template('navbar') . '";');
Also, if you would like to have the name appear in the navbar when viewing the page,use
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
above eval('$navbar = "' . fetch_template('navbar') . '";');
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.