![]() |
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? :confused:
|
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 |
Ouch...
--------------- Added [DATE]1215518983[/DATE] at [TIME]1215518983[/TIME] --------------- Not bad. Looks bearable. Thanks for the tip. |
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:
|
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:
|
Thank you. And is there a place where all db functions of vBulletin are listed?
For example what's wrong with this code: Quote:
|
Just include global.php...In your case, you should use query_first() or query_first_slave(), either will work.
|
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.
|
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.
|
All times are GMT. The time now is 09:13 AM. |
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:
|