vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Template varibales Problem (https://vborg.vbsupport.ru/showthread.php?t=311698)

NetSlider 05-27-2014 08:30 AM

Template varibales Problem
 
Hi,
i try to create my own mod using the HOWTO in "Articles", but nothing works. The "my_test" is cached (not red in debug mode) but the variables are empty or NULL or anything else which makes Problems :D.

plugin1 (Hook: forumhome_start):
PHP Code:

          $templater vB_Template::create('my_test');
          
$templater->register('test1'22);
          
$templater->register('test2'23);
          
$my_template $templater->render();
vB_Template::preRegister('FORUMHOME', array('my_test' => $my_template)); 

plugin2 (Hook: cache_template):
PHP Code:

$cache[] = 'my_test'

template-part: (name: my_test)
Code:

{vb:raw test1} <br>{vb:raw test2}
inserted line in FORUMHOME:
Code:

{vb:raw my_test}
Could anyone say me, where the mistake is?

kh99 05-27-2014 09:00 AM

It works for me. Where in FORUMHOME did you insert the code? Maybe it's there but not visible for some reason (check the page html source). Also make sure your plugins have "Plugin is Active" set to yes, and if you have multiple styles, make sure you're looking at a style that's using the template you modified.

NetSlider 05-27-2014 01:14 PM

Thank you,
i don't know why, but i only have to reboot the server.

Another question about variables:

are there any possibilites to print a complete array with only one entry?

i mean somethink like:
Code:

foreach (...) {
{vb:raw myvar.key}
}

this would be nice for tables.

cellarius 05-27-2014 01:21 PM

See https://vborg.vbsupport.ru/showthread.php?t=221560.

You may want to have a look at other articles in that section, too.

NetSlider 05-27-2014 01:31 PM

Quote:

Originally Posted by cellarius (Post 2499624)
See https://vborg.vbsupport.ru/showthread.php?t=221560.

You may want to have a look at other articles in that section, too.

oh yes. That what i'm looking for.
you can mark this here as solved.

Thanks to everyone


All times are GMT. The time now is 07:06 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.03269 seconds
  • Memory Usage 1,725KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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