• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to access container_public_params in templates?

#1
Please bear with me here, just learning how to set some data that can be used in the template.

I've created a really basic Add-on that has a container_public_params listner, as such:

PHP:
class Sample_Listener_Test
{
    public static function getString(array &$params, XenForo_Dependencies_Abstract $dependencies)
    {
        $params['teststring'] = 'hello world';
    }
}
I am assuming this is the correct way to add an addressable string into the public params so that it can be referenced in the container? The string is intended to be used for dressing the logo_block.

Now how do I reference this parameter in the header/logo_block template? Have I missed the point all together?

Any pointers would be very much appreciated.
 

Shadab

Well-known member
#2
Use this format to access a variable in a template: {$variable}

Code:
<div class="pageContent">
	...
	{$teststring}
</div>

hello_world.png
 

Shadab

Well-known member
#5
For passing the parameters only on a specific page, you could try to extend the controller and override the action that's being called for building that page. In your case, that would probably be XenForo_ControllerPublic_Forum and actionIndex.
 
#6
For passing the parameters only on a specific page, you could try to extend the controller and override the action that's being called for building that page. In your case, that would probably be XenForo_ControllerPublic_Forum and actionIndex.
I see. So, this hook allows only site-wide parameter injection, right?