How to access container_public_params in templates?

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 https://f-number.com/dof/admin.php?code-event-listeners/container_public_params.1/editcontainer_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.
 
Use this format to access a variable in a template: {$variable}

Rich (BB code):
<div class="pageContent">
	...
	{$teststring}
</div>


hello_world.webp
 
How do we determine the place in code where this hook is called? Supposing I want to pass the specific parameter only on a page with thread list?
 
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.
 
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?
 
Top Bottom