PDA

View Full Version : Template varibales Problem


NetSlider
05-27-2014, 08:30 AM
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):

$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):
$cache[] = 'my_test';

template-part: (name: my_test)
{vb:raw test1} <br>{vb:raw test2}

inserted line in FORUMHOME:
{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:
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
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