![]() |
|
|
Article Options |
|
[How-To] vBulletin API Basics: Creating Custom Pages & Misc.
by
Rating:
Ever wanted to create your own vBulletin-powered page but didn't know how? With this [How-To], you can. NOTE: This is a vBulletin 3.5 version of Gary King's Manual, updated and expanded. NOTE TO CODERS: THIS TUTORIAL CONTAINS MOST UP TO DATE INFORMATION IN THE WHOLE THREAD. IF ANY FURTHER POSTS BY 3RD PARTIES (INCLUDING OTHER CODERS) CONTAIN ANY INFORMATION THAT COMES INTO A CONFLICT WITH ANYTHING SAID IN THIS TUTORIAL, IT CAN BE CONSIDERED FALSE, UNLESS I VERIFY IT. BASICS Creating a custom vBulletin-Powered Script
You are done! Note that template names are prefixed with test_. Prefixing is a good practive, as it makes it easier to manage the mass later on. This applies not only to templates, but also to custom phrases and options. On to the next section: Adding Custom Online Locations If you want Who's Online to reflect your new custom page when someone is browsing it (rather than Unknown Location), do the following steps:
You are done! Using vBulletin-powered scripts outside vBulletin Directory REPLACE
WITH
Where "/home/site/public_html/forums" must be replaced with an actual system path to your forums. Also, make sure you add the following code in the beginning of any relative links:
Creating "Subpages" If you want to create "subpages" within your custom page, simply wrap blocks of code with the following structure:
Limiting Access to the Script Registered Members Only UNDER
ADD
Certain Usergroups Only (In this example, 6 and 7)
You can also use the limits in your vBulletin templates. Here are to examples that you can use (but you are not limited to using them, so utilize your imagination):
ADVANCED CODING Do not read below unless you have a basic knowledge of PHP and a general idea of what is it that you are doing. vBulletin Phrase Replacements As you might now, vBulletin supports phrase replacement. In other words, if your phrase (in this example, "testphrase") contains the following text,
What's it for? Well, if you use the following PHP code, you get "The user testuser has written 10 posts" in $testvar:
You can use as many replacement as you want in the construct_phrase() function. 1st replacement corresponds to {1}, 2nd - to {2}, Nth - to {N}... You can also use these replacements in templates, with a slightly different syntax:
Using Variables in Templates To use variables in templates, follow these rules:
Warning: As a security measure, avoid using arrays $_POST[], $_GET[], $_REQUEST etc., in your templates - even though you may if you really need to. Using Conditionals in Templates vBulletin 3.0.0 and up features templates conditionals. Example:
In conditionals (the part highlighted in blue), and ONLY in conditionals, you should use the regular PHP variable-naming syntax (disregarding what's said in "Using Variables in Templates" part of this tutorial). Just put in whatever you would normally put into the if() clause. Notably, vBulletin does not feature an "else if" clause within its templates system. Therefore if you need more than one conditional, you can nest them. Example:
You can nest any number of conditional clauses, as long as the code is valid. Valid vBulletin URL Formation
Creating Custom Standard Error Messages Read very carefully. To show standard error messages, you must:
Creating Redirects To create a redirect you must:
Once you are done with that:
Done! >> END OF MANUAL Last edited by Psionic Vision : 29 Nov 2005 at 17:31. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Views: 59455
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
__________________
Hi, I am Brad and I'm lost in my own head! ![]() "C++ : Where friends have access to your private members." — Gavin Russell Baker. No members have liked this post.
|
![]() |
«
Previous Article
|
Next Article
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
| Article Options | |
|
|
| New To Site? | Need Help? |
All times are GMT. The time now is 22:20.


