XF 1.2 if conditional doesn't work

Luxus

Well-known member
I will keep this brief. I am trying to add a <div> around the form in the thread_delete template if the content template is thread_delete. This is what I added to the thread_delete template and it doesn't work:

Rich (BB code):
<xen:if is="{$contentTemplate} == 'thread_delete'"><div></xen:if>
<form action="{xen:link 'threads/delete', $thread}" method="post" class="xenForm formOverlay">

    <xen:include template="helper_deletion_type_unit" />

    <dl class="ctrlUnit submitUnit">
        <dt></dt>
        <dd><input type="submit" value="{xen:phrase delete_thread}" class="button primary" /></dd>
    </dl>

    <input type="hidden" name="_xfConfirm" value="1" />
    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>
<xen:if is="{$contentTemplate} == 'thread_delete'"></div></xen:if>

The <div> is nowhere to be seen. Any reasons why?
 
If you are already editing the thread_delete template, why do you need the conditional statement to check it is the thread_delete template?
 
If you are already editing the thread_delete template, why do you need the conditional statement to check it is the thread_delete template?
Because the thread_delete (among other similar templates) template is used as its own page (if javascript is disabled and you try to delete a thread or if you just open the thread delete page via right click and open) and as an overlay. For design reasons, I need this extra div in the page, but not in the overlay. In fact, if the extra div is added to the overlay, it messes up the html as the title literally jumps out of the overlay box.
 
Can you do what you need to do in CSS?

When you navigate to the page, rather than the overlay, the main content container has a class of the template name, e.g.

Code:
.thread_delete .xenForm

Would target the form element in the page, but the .thread_delete class is not there in the overlay version.

So you could do something like this:

upload_2014-1-12_22-47-33.webp
 
I won't do any file edits. I just don't see why the if conditional method doesn't work. It works elsewhere.
Why do you think it is available everywhere else?
It is available in container templates such as PAGE_CONTAINER
See file XenForo_ViewRenderer_HtmlPublic and function renderContainer()

You don't need to edit a file, you could extend a function instead.
 
Top Bottom