1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 BBCode Question

Discussion in 'Styling and Customization Questions' started by Joykiller, Jun 27, 2014.

  1. Joykiller

    Joykiller Member

    Now I was wondering Media button that does [youtube]link[/youtube] as it embeds the youtube clip on the forum post. Is there a way to disable it from showing up on another template..

    Example: Youtube Embed html
    Code:
    <xen:if is="!{$contentTemplate} == 'EWRporta_Portal'">
    <xen:else />
    <iframe width="500" height="300" src="http://www.youtube.com/embed/{$id}?wmode=opaque" frameborder="0" allowfullscreen></iframe>
    </xen:if>
    Basically that would check to see if its being parsed on Portal template if so then not display it and if anywhere else it would.

    Doesn't though.. any one got any ideas?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Try targeting it using CSS and display none.

    For example, in my portal add-on I can use:
    Code:
    .ctaFtThreadTextAvatarPage iframe,
    ctaFtThreadTextIconPage iframe
    {
    display: none;
    }
    I don't use xenporta though so you will need to ask in the thread what the equivalent class is, if it exists.
     
    Joykiller likes this.
  3. Joykiller

    Joykiller Member

    Hmm, I tried wrapping the html iframe under youtube bbcode with a div named youtube.
    Code:
    <div class="youtube">
    <iframe width="500" height="300" src="http://www.youtube.com/embed/{$id}?wmode=opaque" frameborder="0" allowfullscreen></iframe>
    </div>
    Then in the Recentnews section it has a bb_code.css link, to which i added.
    Code:
    <xen:if is="!{$contentTemplate} == 'EWRporta_Portal'">
    .youtube{
        display:none;
    }
    <xen:else />
    .youtube{
        position: relative;
        max-width: 100%;
        height: auto;
        padding-bottom: 56.25%; /* Helps maintain a correct aspect ratio */
        padding-top: 30px;
        height: 0;
        overflow: hidden;
    }
    .youtube object, .youtube iframe, .youtube embed
    {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}
    </xen:if>
    However, seems that the conditional statement for <xen:if is="!{$contentTemplate} == 'EWRporta_Portal'"> is not detecting and just bypassing it completely. So even its hiding on the forum page and News page now.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You are using not in your conditional statement.
    So if the template isn't EWRporta_Portal, it won't be displayed.
     
  5. Joykiller

    Joykiller Member

    haha. woops.. But wouldnt that still pass the else statement?
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    You can't use conditional statements in css templates anyway.
     
    Joykiller likes this.
  7. Joykiller

    Joykiller Member

    Well..
    Code:
    <xen:if is="{$contentTemplate} == 'EWRporta_Portal'">
    .youtube{
        display:none;
    }
    </xen:if>
    Still doesnt want to work. Oh it wont work in CSS?
     
  8. Joykiller

    Joykiller Member

    Thanks for your help I was way over complicating ****. I took a look over what the hell i was doing now its working thank you!
     

Share This Page