thread_view conditional Template Modification

MattW

Well-known member
I'm trying to change what is being displayed in thread_view using Template Modification

This is my template modification

Code:
<xen:if is="{$contentTemplate} == 'thread_view'">
<div id="slidingDiv">
Matt Test 1
</div>
<xen:else />
$0
</xen:if>

However, it's not displaying what I want in thread_view

I've checked the source looking at the content div

Code:
<div id="content" class="thread_view">

But it's displaying the contents of the else statement.

Any idea why this isn't working as expected?
 
Which template are you adding that code to?
It's a template which is included inside thread_view. The actual template is called similar_threads which is inserted with the Listener looking for the hook thread_view_qr_after
 
Why do you need to check if the $contentTemplate is thread_view if the code is going into the thread_view template?

Also, why use a Listener and Hook if you can just use the template modifications system to add the content to the template? :)
 
Ah ok. This will work:
Code:
<xen:if is="{$thread.thread_id}">
    <div id="slidingDiv">
        Matt Test 1
    </div>
<xen:else />
    $0
</xen:if>

{$thread.thread_id} will only be set in thread_view, it won't be set in thread_create :)
 
Top Bottom