Unless I misunderstand you'd just uncheck the widget to be in the widget control.Anyone know how to hide a widget if someone is viewing XFMG (Xenforo media gallery)? I don;t want the widget to show when in the gallery, just the forums.
It's a custom widget which contains a banner. I have hidden it with js but wanted to know if there was some sort of conditional like if xfmgUnless I misunderstand you'd just uncheck the widget to be in the widget control.
What widget are you trying to hide?
<xf:set var="$OnThisDay" value="{{ date($xf.time, 'd m') }}" />
<xf:if is="$OnThisDay == '30 05'">
On 30 May this event happened......
</xf:if>
You don't need a template condition for this, just use theIs there a way to detect javascript? So if Javascript is disabled, we can show a message or something?
<noscript>
html tag You don't need a template condition for this, just use the<noscript>
html tag
![]()
<noscript>: The Noscript element - HTML | MDN
The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.developer.mozilla.org
AFAIK, Unfortunately you cannot know how a browser renders a page until it does so. Template conditions are basically PHP Code, so they don't know much about the browser. You can bypass that limitation e.g. if you set a cookie via javascript and check for it's existence. But you cannot do that on the 1st page load: First PHP has to build the page, then the browser has to render it (and execute javascript) and then you can do something with it.Hm, would be ideal if it was possible with conditionals too so we can disable some functions until they turn it on.
You can useI mess with templates so infrequently - how do I display all the variables available in a template? Globally?
dump()
. A lot of output you will get if you insert this in your template: {{ dump($xf) }}
.Is there a way to hide something only from mobile devices?
Use media queries...Is there a way to hide something only from mobile devices?
@media (max-width: @xf-responsiveWide)
{
// your stuff displayed only in wide screens, so hidden in narrow and medium screens
}
@media (min-width: @xf-responsiveMedium)
{
//your stuff displayed only above medium screen, so hidden in narrow screens
}
@media (max-width: @xf-responsiveNarrow)
{
//your stuff displayed only on narrow screens
}
etc...
@media (max-width: @xf-responsiveWide) { // your stuff displayed only in wide screens, so hidden in narrow and medium screens }
I created a widget with html and css code called in extra.less ... I should only show it to fixed devices, since it can't be seen well on smartphones and is enlarged. so I need a way to either hide it or adjust the width in mobile browsers@media (max-width: @xf-responsiveWide) { // your stuff displayed only in wide screens, so hidden in narrow and medium screens }
Try this:so I need a way to either hide it or adjust the width in mobile browsers
.block [data-widget-key="youo_widget_key"]
{
@media (max-width: @xf-responsiveNarrow)
{
display: none;
}
}
<xf:if is="{{!$xf.visitor.isMemberOf(1)}}">
$xf.visitor.user_id && $xf.visitor.user_state == 'valid'
in extra.less template? etc etc i tried putting the conditional in there and it only hides it for everyone and ignores the thing. or how can i put the only that element in the conditional etc....We use essential cookies to make this site work, and optional cookies to enhance your experience.