The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to get this PHP code into a template
I've been doing some reading and apparently you can't use PHP directly in the templates. The php code works perfectly standalone, but wanted to integrate it in a vBulletin template. I've made a plugin in global_start with the php code I want to use, but wasn't sure what to do next (if that even was right). I also read some in the API documentation, but didn't manage to get any further with that.
What I want to do is basically just connect to a database, selecting everything from a table and displaying it in a table(html) and print row for row. Below is the code of what I'm going to do (just edited the values). Hope anyone can help PHP Code:
|
#2
|
|||
|
|||
What if you assign the HTML to a variable in your code above, in the if statement, then just place a reference to the variable name in the template where you want it.
PHP Code:
Then in your temaplate, you should be able to call a reference to $output and it will hopefully work for you. This should at least be a start in the right direction. |
#3
|
|||
|
|||
That worked perfectly for my page I was working on too.
Just to make it a tad clearer for people like myself: In your .php page, have the output go into a variable (using the above custom page code) just above where you call the template you want it inserted into. Then in the template call that variable to stick it's html in. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|