Coding vB

soccerfreak

New Member
I looked around and cant find this anywhere.

Are there any good tutorials to learn how to code vB? or maybe a certain lanuguage to know to code vB?

thank you
 

g0rn

New Member
It's just PHP ;)
Download mods, try to understand, how do they work, see vbulletin files, classes...
Also, this tutorial can help you - [How to] Write Plug-ins/Hooks - vBulletin.org Forum :

This is your basic guide to making plug-ins and hooks, as we are all coming over from the 'hack the files' mentality I am posting this thread more for people that are used to hacking the 3.0.x source code and looking to port modifications. Although a newbie should be able to come away with a good understanding of how to do this to :).

Things to consider

Ok before we get started here are a few things to keep in mind. First and foremost plug-ins are stored in the database, serlized, unserlized and evaled on page generation. If you code preforms badly with such a wrapper forget making a plug-in and just hack it, trust me you'll thank yourself for it when your forum gets large.

Second thing, hooks will not get you into every corner of the code. Some things will always be done best with a hack. For example if you are looking to add something but need to query the db for some extra data and want to avoid and extra query (in other words you are going to modify an existing one with a join or such) forget it and hack it in, there are no hooks that let you modify existing queries.

Last but not least hooks are not magic, don't add a million of them and expect your forum to run as fast as it did when you first installed it. Only plug-in/hack-in what you really need!

Ok enough with the boring stuff, lets add our first plug-in!

Basics:

First thing you need to do is make sure plug-ins are enabled, you can find this option in the admin cp by browsing to vBoptions -> Select Plugin/Hook System from menu -> Set Enable Plugin/Hook System to yes.

Now head to the add plug-in page located at http://www.yoururl.com/forum/admincp/plugin.php?do=add

Lets go over what all these options mean:

Hook Location: This is where the php code will be executed at, hook locations at defined all across vBulletin. You can find them by opening and php file and searching for the var $hook. When you find a bit of php code like this you have found a hook:

PHP:
($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false;

See that bit fetch_hook('showthread_postbit_create')? Well the text "showthread_postbit_create" is the name of this hook, if you look in the drop down you will find that listed in there somewhere. Incase you are wondering that hook is located in showthread.php at line 1012

Title: This is the title of your plug-in, use a good name because this is the only thing you have to identify the plug-in in the plug-in manager.

Plugin PHP Code: Can you guess? This is where you put your custom php code, on page generation it is executed at the hook location in the .php files. Note that you do not need <?php ?> tags here, in other words:

wrong:

PHP:
<?php $var = true; ?>

Right:

PHP:
$var = true;

Plugin is Active: Allows you to turn the plug-in on/off without removing it. If set to 'yes' php code is ran on page execution.

Edit - Thanks to Revan for this addition:


Tips

At first approach coding the plug-in like a hack.

Open the php file you would normally edit and get your mind around the new code.

Once you have a good understanding of the new code you should start looking for where you need to add your custom php. Once you find the right location in the code start looking for a nearby hook, if you don't see one you can work with you are out of luck! :(

Edit- Thanks to KirbyDE for his addition:



Once you find your hook note its name and apply your changes in the admincp, from here on out you are on your own :)
 

soccerfreak

New Member
Hey thank you so much for finding that link

sorry to be a pain again but how about coding designs to work in vB (i guess its called skinning)? any thoughts on that
thnx again
 

Itsuki Minami

New Member
o.o thats really easy is just php and html, all the rest is in all style options like css and all that, you just have to play a little
 

soccerfreak

New Member
So i need to know all three languages in order to code?
if so any good sites or video to watch to learn PHP?
thank you for quick reply
 

Itsuki Minami

New Member
xD na man is easy look, i code my themes looking what will do if i change this is just to wathch what changes whe you do something
 

Juiceh

New Member
Looking at what Itsuki writes, I can't say I feel he has alot of experience in coding.
For soccer, vB isn;t coding, it's just the name of the BB. It's coded with PHP.
You can learn PHP here: PHP: Hypertext Preprocessor, but it can take a while before you know PHP coding at full scale.

Good luck:)
 

lordsyntax

New Member
SCNR hehehehhe :)
PHP:
if($girl['looks'] == "hot"){
if($beer == "cold"){
$life = "Sorted!";
}elseif(function_exists($girl_get_beer) == true){
if(msg_send ($girl['job_que'], 1, 'Get me a beer out of the fridge!') === false){
$life = "Get a new girl!";
}
}else{
array_push($girl['functions'], 'get_beer');
}
}else{
$life = "Get a new girl!";
}
echo $life;

But i would pretty much like to see one of Itsuki Minami´s designs ^^
 

Itsuki Minami

New Member
o.o i'm just don't know php ;D but i can code themes o.o i have done it xD i will show my zero theme <_<U but i just don't backup xD
 

soccerfreak

New Member
what do you guys mean by XD, and so can I skin without PHP or do you guys I need to learn it to be able to skin?

also I want to download vB and mess around with, do I need to install it on a site or can I just install it in a folder and be able to mess around wiht it on my computer? thank you
 

lordsyntax

New Member
for the skinning part it should be sufficient if you know your way around HTML.

vB is a PHP based script, so just installing it like a windows software won´t work.
It needs to be run on a webserver that supports PHP, plus you need a mysql server for the database.

To "mess around" with it you should get a copy of LAMP or XAMP, install that on your machine and then install vBulletin afterwards on your local webserver :)
 

ahmedr

New Member
www.w3schools.com is a good place to learn MANY coding tutorials
and they get straight to the point, they do'nt talk to much if you know what I mean. Check it out for your self, its like a summary of all the important things you need to know for so many languages, and very easy to follow with example guide lines & "try it yourself".
I find it the best site to get a quick answer to coding, as for designing thats a different story, but when you know the codes you can use any design program and implement the code yourself if there's any errors. Thats as much as I know.

Also as stated, to test php with know server download WAMP (Windows,Apache,Mysql & Php) for windows or XAMP (uniX,Apache,Mysql & Php) for unix

for more instructions why not download lynda.c o m php with Mysql essential training here it is:

Code:
http://rapidshare.com/files/75091425/php-vih.part01.rar 
http://rapidshare.com/files/75091422/php-vih.part02.rar 
http://rapidshare.com/files/75091284/php-vih.part03.rar 
http://rapidshare.com/files/75091292/php-vih.part04.rar 
http://rapidshare.com/files/75091417/php-vih.part05.rar 
http://rapidshare.com/files/75089747/php-vih.part06.rar

OR only The PHP Essential training version, which can be downloaded from here:

Code:
http://rapidshare.com/files/44117967/PHP.E.T.CD1.part1.rar 
http://rapidshare.com/files/44119217/PHP.E.T.CD1.part2.rar 
http://rapidshare.com/files/44116735/PHP.E.T.CD1.part3.rar 
http://rapidshare.com/files/44127349/PHP.E.T.CD1.part4.rar 
http://rapidshare.com/files/44128825/PHP.E.T.CD2.part1.rar 
http://rapidshare.com/files/44130678/PHP.E.T.CD2.part2.rar 
http://rapidshare.com/files/44133439/PHP.E.T.CD2.part3.rar 
http://rapidshare.com/files/44135619/PHP.E.T.CD2.part4.rar 
http://rapidshare.com/files/44136681/PHP.E.T.CD2.part5.rar

These tutorials are for novises, they will tell all you need to know as a starter, from downloading & installing php & mysql on your PC.....to working the magic, but then its up to you to start testig with your programming, & they give you excersices to work through as well

Hope this is any use for u

regards
Ahmed
 
Top