vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   First Look at vBulletin 4 Template Variables (https://vborg.vbsupport.ru/showthread.php?t=217569)

Abhik 05-13-2010 02:53 AM

Can someone please convert these for me?

Code:

$spacer_open
$spacer_close


TalkVirginia 05-13-2010 04:05 AM

Quote:

Originally Posted by Abhik (Post 2036110)
Can someone please convert these for me?

Code:

$spacer_open
$spacer_close


I haven't tested this but it may be something like:

{vb:raw spacer_open}
{vb:raw spacer_close}

unless 4.x has a different mechanism.

Double check the brackets, I'm not sure if they are correct.

Abhik 05-13-2010 09:03 AM

Nope.. they aren't correct. I already tried that before posting here :)

bananalive 05-13-2010 10:14 AM

Quote:

Originally Posted by Abhik (Post 2036249)
Nope.. they aren't correct. I already tried that before posting here :)

TalkVirginia is right:
HTML Code:

{vb:raw spacer_open}
{vb:raw spacer_close}

You might need to pre register the variable, either in plugin or php file.

PHP Code:

vB_Template::preRegister('YOUR_TEMPLATE',array('spacer_open' => $spacer_open'spacer_close' => $spacer_close)); 


Abhik 05-13-2010 10:59 AM

Quote:

Originally Posted by bananalive (Post 2036279)
TalkVirginia is right:
HTML Code:

{vb:raw spacer_open}
{vb:raw spacer_close}

You might need to pre register the variable, either in plugin or php file.

PHP Code:

vB_Template::preRegister('YOUR_TEMPLATE',array('spacer_open' => $spacer_open'spacer_close' => $spacer_close)); 


Can you tell me how to do that as a plugin?

Davidinh 05-24-2010 12:46 PM

Hi everyone

i have a php file that contain some variable and i tried to connect them together like a URL (link)
$folder = $folders = $vbulletin->options['folder'];
$subfolder = $folders = $vbulletin->options['subfolder'];
$file = $folders = $vbulletin->options['file'];

$url = $folder/$subfolder/$file;
then i got an error like

Warning: Division by zero in E:\xampp\htdocs\test\test.php on line 184

note: those code on line 184

any help or suggestion will be appreciated

or with those variable how can i put them in my template
{vb:var folder}/{vb:var subfolder}/{vb:var file}
within $templater->register('');

is it correct ?

thanks,

TalkVirginia 05-24-2010 02:28 PM

Quote:

Originally Posted by Davidinh (Post 2042694)
Hi everyone

i have a php file that contain some variable and i tried to connect them together like a URL (link)
$folder = $folders = $vbulletin->options['folder'];
$subfolder = $folders = $vbulletin->options['subfolder'];
$file = $folders = $vbulletin->options['file'];

$url = $folder/$subfolder/$file;
then i got an error like

Warning: Division by zero in E:\xampp\htdocs\test\test.php on line 184

note: those code on line 184

any help or suggestion will be appreciated

or with those variable how can i put them in my template
{vb:var folder}/{vb:var subfolder}/{vb:var file}
within $templater->register('');

is it correct ?

thanks,

If you are going to use your first example you need to enclose your slashes in quotes like so... $url = $folder . '/' . $subfolder . '/' . $file however I'm sure there is a better way of doing this. Maybe reading the folder path and parsing each part out into separate variables depending on what you want to do.

Davidinh 05-24-2010 09:12 PM

thank you very much TalkVirginia
it works

Frank T 06-22-2010 01:44 AM

Quote:

Originally Posted by TalkVirginia (Post 2006341)
Depending on where you want to place it. For example, if you want to place above the thread, use the showthread_above_posts template hook, then create a plugin using the showthread complete hook location. If you open showthread.php, examine around line 2176 and below.

Try this example:

1. Add a new custom template with the following contents:

Product: vBulletin (or if you are creating a mod, choose your product id)
Style: Style of your choice
Title: mytemplate

HTML Code:


<div id="pagetitle" class="pagetitle">
        <h1>Thread: <span class="threadtitle">{vb:raw msgbox}</a></span></h1>
</div>

2. Create a new plugin:
Product: vBulletin (or if you are creating a mod, choose your product id)
Hook Location: showthread_complete
Execution Order: Leave as default
Plugin PHP Code:

PHP Code:


$msgbox 
"Hello World";
$templater vB_Template::create('mytemplate');
$templater->register('msgbox'$msgbox);
$template_hook[showthread_above_posts] .= $templater->render(); 

Plugin Is Active: Yes

What's the difference between the "template hook" and "hook location?" Why aren't they the same thing? You've used "showthread_above_posts" template hook and "showthread_complete" hook.

noppid 06-22-2010 01:42 PM

The template hook, $template_hook['showthread_above_posts'] for example, is the variable you want to populate to display your data. The hook location, showthread_complete for example, is the hook in the php file that you use to load the template variable with your data by rendering a template for instance. You can select these hook locations in the plugin manager drop down when you create a new plugin.


All times are GMT. The time now is 03:18 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.01846 seconds
  • Memory Usage 1,757KB
  • 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
  • (3)bbcode_html_printable
  • (3)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete