Conditionals

DBA

Well-known member
I'm having a little trouble figuring out how to do a certain conditional. I made some changes to the message template however I've since noticed that both the post view and conversation view use this template. What (else) conditional would I use to only have these changes applied to the post view only? For example:

<xen:if is="conversation">
This shows on conversations only
<xen:else />
This shows everywhere else
</xen:if>


Also would this same conditional work in the PAGE_CONTAINER? For example:

<xen:if is="post view">
Show this while viewing a thread
<xen:else />
This shows everywhere else
</xen:if>
 
I still can't seem to figure it out. Here's what I'm trying to do.

I added a green header to my posts and it looks like this.
post.webp

However this applied the same styling to the conversations and also made the times incorrect.
convo.webp

So now I'm trying to get a conditional that will show my post header code only in the posts and not in the conversations.

Here's the post header code that I currently have in the message template.
Code:
<div id="dba_message_header"> <!-- taken from post -->
<div id="dba_message_hl">
                <xen:if is="{$post.canInlineMod}"><input type="checkbox" name="posts[]" value="{$post.post_id}" class="InlineModCheck item" data-target="#post-{$post.post_id}" title="{xen:phrase select_this_post_by_x, 'name={$post.username}'}" /></xen:if>
                <span id="item muted">
<xen:comment>                    <xen:username user="$post" class="author" />,</xen:comment>
                    <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="datePermalink"><xen:datetime time="$post.post_date" /></a>
                </span>
</div>
<div id="dba_message_hr">
                <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="item muted postNumber hashPermalink OverlayTrigger" data-href="{xen:link posts/permalink, $post}">#{xen:calc '{$post.position} + 1'}</a>
</div>
</div>
 
So now I'm trying to get a conditional that will show my post header code only in the posts and not in the conversations.
Have you tried wrapping the post header code in: <xen:if is="!{$message.conversation_id}">...</xen:if>

Or alternatively, have you tried just adding some CSS to EXTRA.css for the thread posts only?
 
  • Like
Reactions: DBA
Have you tried wrapping the post header code in: <xen:if is="!{$message.conversation_id}">...</xen:if>
That worked, thanks Brogan!

Someday I'll have a better grasp on the more complex conditionals. :cool:
Or alternatively, have you tried just adding some CSS to EXTRA.css for the thread posts only?
Yes, however I also moved some of the code up there (Time stamp and post number).
 
Top Bottom