View Full Version : How using php/mysql in template into IF conditions
fabioski
03-01-2008, 10:11 AM
I have read this manual:
https://vborg.vbsupport.ru/showthread.php?t=98009
How can I insert php code and mysql queries into the forum template?
For example, how can I print this:
<?
if ($aaa = 345) {
echo "<p>hello to world</p>";
}
?>
in the homepage page?
Dismounted
03-01-2008, 10:51 AM
You use PHP code in plugins and assign data to variables in those plugins. Then you use the variables in your template. PHP code can not be directly run in templates.
fabioski
03-01-2008, 11:11 AM
Many thanks Dismounted.
Where can I find a simple example/tutorial that explain to me how can I do waht you have explain to me?
--------------- Added 1204380066 at 1204380066 ---------------
I have create this plugin
Product: vBulletin
Hook Location: showthread_complete
Title: Helloworld
Plugin PHP Code:
$testoski = 'hello world';
Plugin is Active: Yes
Then in the template SHOWTHREAD I add:
<p>Plugin: $testoski</p>
But it doesn,t work.
Dismounted
03-02-2008, 04:17 AM
That should work. Have you turned on the Plugin System in vBulletin Options?
DivisionByZero
03-02-2008, 05:38 AM
also, keep in mind that your variable is ONLY going to show up in showthread.php AFTER the last postbit (per-page), considering the hook location.
if you're trying to run that plugin in the header, navbar, footer, etc.. it's not going to work unless you change the location to global_start :)
fabioski
03-02-2008, 03:40 PM
Now it works!
I hadn't active plugin/hook systems.
Thanks.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.