![]() |
[HOW TO - vB4] Create your own vBulletin page
This is an updated article on how to create your own vbulletin powered page. It's only for use with vB4.
This is NOT my work. I'm posting this from another thread where vB Style took the time to write this out. And his work is based on the article by Gary King here - How to create your own vBulletin-powered page! (uses vB templates) Instructions to Create your Own Page: 1. Create the php page: - Create a new file, whatever you want to call it (let's say test.php). - Open up test.php and add the following (replace TEST with whatever template you want to show - WARNING: the template name is CASE SENSITIVE!!!): Code:
<?php 2. Create the Template: - If you are in debug mode, create the template in your MASTER STYLE so it shows up in all your styles, otherwise make sure you create the template in the style you are using. If following the page above, call the template TEST (WARNING: the template name is CASE SENSITIVE!!!) with the following content: HTML Code:
{vb:stylevar htmldoctype} Instructions to Add your Page to the Who's Online List (WOL): Create two plugins using the following hooks. Replace mypage and similar with your information. 1. hook location - online_location_process: Code:
switch ($filename) 2. hook location online_location_unknown: Code:
switch ($userinfo['activity']) The colored part in the code above shows what you need to change in the plugins (both reds should be the same and both blues should be the same, whereas green can be whatever you want). Please see this article for help with rendering templates - [vB4] Rendering templates and registering variables - a short guide |
Thanks Lynne for compiling this - this will be most helpful for many users, no doubt :)
So, I gather you agree with my doubts that the NO_REGISTER_GLOBALS constant is still needed? |
Quote:
|
Excellent! :)
|
Thanks for the article Lynne :)
[high]* Brandon Sheley bookmarks this one[/high] |
Might want to add if conditions to your article as well. I did a search through templates and found this:
To do an if condition in a template: HTML Code:
<vb:if condition="$myvar['mytable']"> |
There are already articles about conditions to use in templates. I would just be repeating them by putting them in this article. There are also articles about rendering templates and registering variables also (which I linked to). I wanted to put this up as just a basic outline to get someone started.
|
Actually you point me to one article referring to conditions. I have not found one anywhere. You do that then your my savior.
|
Quote:
|
Quote:
|
Where we have to upload test.php
|
Quote:
|
Nice, and what do you do if you want to have 3 columns in your page? Right now I had to create a table with 3 td, but I had rather avoid that
|
Quote:
|
Got your first reply. Sorry Lynne. I asked because I found you extremely helpful and because I could not find any places by vb to explain about the new css, until I saw that there were new templates.
Specially whatever you put in $stylevar does not necessarily gets implemented. So instead of thinking that they were bugs, I inquire first. |
Lynne, so how would we call multiple templates for the same custom page and it actually work?
|
You would do it as before, only use the new syntax. So, something like this:
PHP Code:
|
EDIT: I'm a fruitcake, damn pain pill is kicking my butt right now.
PHP Code:
Thanks tho, at least I understand now. --------------- Added [DATE]1258523530[/DATE] at [TIME]1258523530[/TIME] --------------- Ok next question, I am reusing the same variable for different pages so I am not having a cluster of different variables within conditional statements. Right now it seems that is confusing me or its the meds, either way is it safe to say I can keep doing that or should I change it? PHP Code:
|
Thank your tutor.
I had met following error, when I using this template page, there is a cookie sent already. Uh! PHP Code:
How could I solve it? or what deos it mean in this case? I hope your teaching. Thanks. |
Be sure that there's nothing before <?php
|
Quote:
If you are wanting to register that variable on each page for use in the template, you need to put that line inbetween the $templater = vB_Template::create('whatever_template') and the $templater->render() lines. edit: Or actually, you may be able to just preregister it at the top of you page for the template. See the article I link to in my first post to find out about preregistering variables. |
Replace the line:
require_one ./gobal With: PHP Code:
|
Quote:
I create new my.php file. and do define this scripts refer to template files. Regards. --------------- Added [DATE]1258599895[/DATE] at [TIME]1258599895[/TIME] --------------- Quote:
|
Quote:
PHP Code:
|
Quote:
|
What's with
PHP Code:
Some files in vB4 have it^^ |
You may need to add those lines depending on what you do in your code. But, every page doesn't need those lines. I *think*, but I'm not positive, that if you have hooks in your page, you will want to include those lines. But, since usually there aren't any hooks added into a custom page, then those lines aren't needed.
|
Brilliant, thank you Lynne.:up:
|
I've set this up on my test site, and it works OK while i'm logged in, but when I'm not logged in, and I visit this custom page, I just get a plain white screen.
looking at a source of this plain white pages shows me: Code:
<!-- BEGIN TEMPLATE: dkp_template --> Code:
{vb:stylevar htmldoctype} |
Quote:
|
Assuming you mean the error log I have access to via my hosts cpanel interface, the white page does not generate an error in there at all.
here's the contents of the php file. (dkp.php) PHP Code:
|
Take this line out of your template and see if it works:
HTML Code:
<iframe name="dkp_frame" width=100% height=1700px SCROLLING=no FRAMEBORDER=0 src="/25manwrathplus">dkp_frame</iframe> As for error_logs, I have no idea where they are in cPanel, I just know I get mine from a logs folder where the access_logs are also kept. |
Ok, did that, but I'm afraid it dosen't help.
happens in both IE8 and Firefox 3.5 I dunno if it is suppose to help, but I even rebuilt the styles from the ACP after the change and it still didn't change. |
You did what? I suggested a couple of things (remove the code, register the variable).
edit: It works just fine for me if I remove the line I suggested you remove. |
I think you edited your post. I did what you suggested before you edited your post. (remove the iframe)
I'm afraid I dont understand what "register the $show variable" means. I know where the error logs are in cpanel, they are just called "error logs" (I know the log works because the live version of my site generates a few errors sometimes with one of the less used styles) and they dont generate an errors relating to this custom page. |
And I edited my post while you were writing your post again. It works just fine for me if I remove that line from the template. I get a page that just says "MCO DKP" (then new line) "The MCO DKP System".
|
ok, can you confirm the iframe is what breaks it for you? (you doing this to your own test site or something?) ie, does it go white while logged out if you add the iframe?
thanks for your time. |
It goes white if I logout if I add the iframe, yes. That line is definitely the problem. I also get an error when logged in with that line (cannot find/25manwrathplus).
|
Ok, Can't immagine why an iframe would do that.
Well thanks for your time anyway. |
What's the CSS page for this page? Is it vbulletin.css
|
All times are GMT. The time now is 05:59 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|