vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Print PHP variable to screen. (https://vborg.vbsupport.ru/showthread.php?t=181693)

Jwoody 06-06-2008 12:29 PM

Print PHP variable to screen.
 
Hey, this is my first attempt at any kind of vB mod, and im just wondering how you print a php variable created, to screen? (say, within the meta description tag - the variable has been declared within showthread.php)

Cheers in advance!

Marco van Herwaarden 06-06-2008 01:16 PM

Depending on the location etc, you could use:
- Simply add the variable somewhere in a template that is shown on the page.
- Use the PHP 'echo' comand (might not work on all locations within vBulletin or breaks the default page output, so only really usefull for debugging).

Jwoody 06-06-2008 07:33 PM

Quote:

Originally Posted by Marco van Herwaarden (Post 1542358)
Depending on the location etc, you could use:
- Simply add the variable somewhere in a template that is shown on the page.
- Use the PHP 'echo' comand (might not work on all locations within vBulletin or breaks the default page output, so only really usefull for debugging).

Basically, i've defined a variable within showthread.php, and wish to print it within the postbit_legacy template.

But it doesn't look like you can just place the variable (for state of example, my varible is called $myvar straight into the template and expect it to be printed; do you have to do something to the variable declared within the showthread.php file first?

Opserty 06-06-2008 07:36 PM

In the postbit you will probably have to use [minicode]$GLOBALS[yourvar][/minicode] as the postbit template is evaluated within a function. Typically you can just insert the variable ([minicode]$yourvar[/minicode]) straight into the template.

Trial and error is sometimes the best way to just figure things out. ;)


All times are GMT. The time now is 04:27 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.01538 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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