XF 2.1 Conditonal content in PAGE_CONTAINER?


Active member
I think I know the answer but wanted to check if I'm taking the right approach.

I have a custom template being loaded which is just a copy of thread_view (ie. thread_view_cmpe) with some modifications and it is being returned from my controller. Now I pass a custom entity as a viewParam from the controller to the template. I would like this entity data to be accessible in PAGE_CONTAINER so that I can add a customer header underneath the nav bar (above the breadcrumb).

Initially, I thought about taking the same approach as thread_view, just copy PAGE_CONTAINER into my own copy which my own modifications but then that seemed messy. So now I'll just create a template modification in the appropriate place.

Should I just be adding a code even listening for app_pub_render_page to pass in my custom entity? Then just do a:
<xf:if is="$custom_entity "><img src="{{ $custom_entity .img }}" /></xf>

I think I am reading that I can do this in my thread_view_cmpe to set a variable to pass to the container?
<xf:page option="custom_entity" value="{$custom_entity}" />

thanks in advance!
Last edited: