[Solved]Making custom ContainerParam available in Thread_View

hqarrse

Active member
I am sure this has been covered somewhere in the forums multiple times, but I just cannot find it. Apologies if I am asking an stupid question.

I have a small mod that checks for attachments in posts on a page and sets a variable to 1 or 0 depending on the outcome. The result is used in page_container_js_head to make a decision about advertising content.

This is the abbreviated code:

Code:
class Olivenet_CheckAtts_ControllerPublic_CheckAtts extends XFCP_Olivenet_CheckAtts_ControllerPublic_CheckAtts
{

protected function _postDispatch($controllerResponse, $controllerName, $action)
{
..........
........
$controllerResponse->containerParams['hasAttachments'] = 1;
.............

}
}

Is there a nice simple way that I can also make the 'hasAttachments' template variable also available in the thread_view template, ideally without adding any significant backend code?

Thanks
 
In this case it was actually very easy once I understood what I was doing - I dip into the XF backend rarely and it's a long while since I got the mod working.

The solution in this case was simply to add the variable to the normal params for that controller (thread in this case) rather than just adding it to the containerParams, so:

Code:
$controllerResponse->params += array('hasAttachments' => '0');
 
Top Bottom