phpbb where to use $template->assign_vars

_Jerry_

Reputable
Joined
Jun 15, 2014
Messages
130
Reaction score
0
FP$
6
I have refereed to the page, https://wiki.phpbb.com/Template.assign_vars how ever, not able to figure out, where to use the code,
Code:
$template->assign_vars(array(
    'S_SOME_VARIABLE'   => $some_variable,
    'NOW'               => $user->format_date(time()),
   )
);
My requirement is to dynamically prepare some values and make this value available in templates.

If anybody know this, please help
thanks
 
I think, "My requirement is to dynamically prepare some values and make this value available in templates." this is explaining my requirement well.
 
Include the code you posted above in the page_header function in includes/functions.php or wherever you want the code to show and then add this:

Code:
<div>{S_SOME_VARIABLE}<br />{NOW}</div>
to your templates. Obviously you need to add the code you posted to the file where you want the code to show, and then add the code I just posted above to the matching template file.

EXAMPLE
ADD to the page_header function in includes/functions.php
Code:
    $template->assign_vars(array(
        'S_SOME_VARIABLE'   => $some_variable,
        'NOW'               => $user->format_date(time()),
       )
    );

ADD to the overall_header.html template:
Code:
<div>{S_SOME_VARIABLE}<br />{NOW}</div>

Obviously change the variables to your needs.
 
No problem. If you need any more help, do not hesitate to ask.

Regards.
 
Back
Top Bottom