• 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

#1
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?
 

Brogan

XenForo moderator
Staff member
#2
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.
 
#3
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.
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.
 

Brogan

XenForo moderator
Staff member
#4
You are using not in your conditional statement.
So if the template isn't EWRporta_Portal, it won't be displayed.
 
#7
Well..
Code:
<xen:if is="{$contentTemplate} == 'EWRporta_Portal'">
.youtube{
    display:none;
}
</xen:if>
Still doesnt want to work. Oh it wont work in CSS?