Announcement

Collapse
No announcement yet.

Template conditional doesn't work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dojo
    replied
    Here is another problem I am facing and hope you can guide me to a solution. This is the code I have in POSTBIT_LEGACY. We have ads in the first post and ads in the last post. The issue is that, if we have just ONE post, BOTH ads will appear, which looks really bad. So I'd like the ad in the first post to show and, if there is just one post, the ad that would appear in the last one to not appear anymore:

    Code:
    <vb:if condition="$post['isfirstshown']">
    {vb:raw ad_location.ad_showthread_firstpost_start}
    
    <vb:if condition="$thread['forumid'] == 140">
    AD - version 1
    
    <vb:elseif condition="$thread['forumid'] != 47" />
    AD - version 2
    
    <vb:else />
    AD - version 3
    </vb:if>
    
     {vb:raw ad_location.thread_first_post_content}
     </vb:if>
     
    <vb:if condition="$post['islastshown']">
    
    <vb:if condition="$thread['forumid'] == 140">
    AD - version 1
    
    <vb:elseif condition="$thread['forumid'] != 47" />
    AD - version 2
    <vb:else />
    AD - version 3
    </vb:if>
    {vb:raw ad_location.thread_last_post_content}
    </vb:if>
    Thank you in advance for any ideas or tips.

    Leave a comment:


  • dojo
    replied
    It worked! You're the man

    Thank you for the hints. Glad I could have it solved.

    Leave a comment:

  • BirdOPrey5
    Senior Member

  • BirdOPrey5
    replied
    The problem is if you're in the postbit the variable $forum doesn't exist.

    Use $thread instead.

    Code:
    <vb:if condition="$thread['forumid'] != 47">
    the other possibility is

    Code:
    <vb:if condition="$threadinfo['forumid'] != 47">
    But I think it's $thread.

    Leave a comment:


  • dojo
    replied
    Thank you for the reply. It still doesn't work.

    Leave a comment:

  • Hartmut
    Senior Member

  • Hartmut
    replied
    Try:
    PHP Code:
    <vb:if condition="$forum['forumid'] != 47"
    Does that help?

    Leave a comment:


  • dojo
    started a topic [Forum] Template conditional doesn't work

    Template conditional doesn't work

    Hello, I am trying to display some ads in the posts area (first and last post) and have them show on all forums but one. I have placed this code in my template:

    Code:
    <vb:if condition="$forum[forumid] != 47">
    
    <div id="our-ads">myad code</div>
    
    </vb:if>
    It doesn't work. It displays the same ads on all categories, even if I have set it to not show on the posts in the category 47. I have tried to implement this based on various tutorials I read online, maybe I did something wrong?

    Appreciate any hint.
    Thanks in advance.

Related Topics

Collapse

Working...
X