Hey,
I'd like to create my first own MOD, but I need some assistance in this basic question:
What's the difference between assign_vars() and assign_block_vars(). This two methods are required (ok, not really, they're but useful) in phpBB-based pages.
I just noticed, that assign_block_vars is used for arrays, while assign_vars is used for variables.
Is that the only difference?
Greets,
Niklas
assign_vars() or assign_block_vars()
- TheNick
- New member
- Posts: 10
- Joined: 06 Jul 2009, 18:51
- Real name: Niklas
- Location: Toenisvorst, Germany
- Contact:
assign_vars() or assign_block_vars()
PM me for MOD-translations into German
My website - CTO Elektrotipps.de
My website - CTO Elektrotipps.de
- onehundredandtwo
- Past Contributor
- Posts: 48
- Joined: 23 Jul 2009, 19:47
Re: assign_vars() or assign_block_vars()
Pretty much, but they both have a different syntax.
For assign_vars() -
and the variable can be accessed in the style by using {VARIABLE}.
For assigni_block_vars() -
and the array can be accessed by using <!-- BEGIN row -->{row.ARRAY_VAR}<!-- END row -->
onehundredandtwo.
For assign_vars() -
Code: Select all
$template->assign_vars(array(
'VARIABLE' => $variable,
));
and the variable can be accessed in the style by using {VARIABLE}.
For assigni_block_vars() -
Code: Select all
$template->assign_block_vars('row',array(
'ARRAY_VAR' => $variable,
));
and the array can be accessed by using <!-- BEGIN row -->{row.ARRAY_VAR}<!-- END row -->
onehundredandtwo.
- TheNick
- New member
- Posts: 10
- Joined: 06 Jul 2009, 18:51
- Real name: Niklas
- Location: Toenisvorst, Germany
- Contact:
Re: assign_vars() or assign_block_vars()
Ah, I see. Thank you!
Ciao,
Niklas
Ciao,
Niklas
PM me for MOD-translations into German
My website - CTO Elektrotipps.de
My website - CTO Elektrotipps.de
Re: assign_vars() or assign_block_vars()
Also, there's the fact that assign_block_vars() is used to build a template loop. Any kind of list that you see generated in phpBB is usually built with the help of assign_block_vars().