vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How using php/mysql in template into IF conditions (https://vborg.vbsupport.ru/showthread.php?t=171789)

fabioski 03-01-2008 10:11 AM

How using php/mysql in template into IF conditions
 
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 [DATE]1204380066[/DATE] at [TIME]1204380066[/TIME] ---------------

I have create this plugin

Code:

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:
Code:

<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.


All times are GMT. The time now is 04:09 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00918 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete