The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Is it possible to write some PHP inside forum templates?
I need to add some extra coding in a custom header that I made for the forum. I need to insert some conditional scripting, which I usually accomplish with PHP. Now is it possible to add some PHP in templates?
|
#2
|
||||
|
||||
You cannot use php in the templates. You need to include the php by creating a plugin at the appropriate hook location.
Refer this http://www.vbulletin.com/docs/html/m..._externalfiles |
#3
|
|||
|
|||
Ouch...
--------------- Added [DATE]1215518983[/DATE] at [TIME]1215518983[/TIME] --------------- Not bad. Looks bearable. Thanks for the tip. |
#4
|
|||
|
|||
I was able to insert some pure PHP things in the header. However I cannot connect to a database, because as soon as I do vBulletin says:
Quote:
|
#5
|
||||
|
||||
As long the MySQL user for vBulletin can access your other database (ie. is on the same server and has SELECT/INSERT/etc. permissions), you can use the "database.table.field" syntax.
PHP Code:
|
#6
|
|||
|
|||
Thank you. And is there a place where all db functions of vBulletin are listed?
For example what's wrong with this code: Quote:
|
#7
|
||||
|
||||
Just include global.php...In your case, you should use query_first() or query_first_slave(), either will work.
|
#8
|
|||
|
|||
With a query_read() you will need to use fetch_array() to actually retrieve rows (usually in a loop). If you need a single row, then you can use query_first() or query_first_slave(), these functions will also read the first (and only) row.
|
#9
|
|||
|
|||
Thank you very much for your notes. Actually everything was alright with the query call. It was a Class that I've used that caused the trouble with some ambiguous code. I've turned it off.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|