Shelley
Well-known member
CSS can be cached. I don't think that will work without a hard refresh.
Won't it work then then without a user refreshing if i understood that correctly?
CSS can be cached. I don't think that will work without a hard refresh.
Won't it work then then without a user refreshing if I understood that correctly?
If it works the same way as this does now...it should...I hope...literally speaking though, time will tell.
I think something is required here.
<xen:if is="{xen:time $serverTime, 'G'} >= 8 AND {xen:time $serverTime, 'G'} < 12">
<xen:set var="$todHeaderClass">morningHeader</xen:set>
<xen:set var="$todBodyClass">morningBody</xen:set>
<xen:elseif is="{xen:time $serverTime, 'G'} >= 12 AND {xen:time $serverTime, 'G'} < 17" />
<xen:set var="$todHeaderClass">afternoonHeader</xen:set>
<xen:set var="$todBodyClass">afternoonBody</xen:set>
<xen:else />
<xen:set var="$todHeaderClass">eveningHeader</xen:set>
<xen:set var="$todBodyClass">eveningBody</xen:set>
</xen:if>
<body{xen:if {$bodyClasses}, ' class="{$bodyClasses} {$todBodyClass}"', ' class="{$todBodyClass}"'}>
I would do like this to define an custom class for the body:
http://xenforo.com/community/threads/please-extend-extra-css-for-user-groups.42588/#post-461384
The conditional block above the body simply allows you to define a class name based on condition (for which you can use the same conditions as this template edit). That will allow you to select on body.className to define custom background colors.
so applying that logic is this correct..
.HTML:<xen:if is="{xen:time $serverTime, 'G'} >= 8 AND {xen:time $serverTime, 'G'} < 12"> <xen:set var="$todHeaderClass">morningHeader</xen:set> <xen:set var="$todBodyClass">morningBody</xen:set> <xen:elseif is="{xen:time $serverTime, 'G'} >= 12 AND {xen:time $serverTime, 'G'} < 17" /> <xen:set var="$todHeaderClass">afternoonHeader</xen:set> <xen:set var="$todBodyClass">afternoonBody</xen:set> <xen:else /> <xen:set var="$todHeaderClass">eveningHeader</xen:set> <xen:set var="$todBodyClass">eveningBody</xen:set> </xen:if> <body{xen:if {$bodyClasses}, ' class="{$bodyClasses} {$todBodyClass}"', ' class="{$todBodyClass}"'}>
...assuming (for the body tag in this instance) that all the css was right in extra.css?
.backDay
{
background: url('http://www.bbsmiley.com/styles/bbsmileyrevamped/xenforo/gradients/bg.png') no-repeat top center #87DBFF;
}
.backNight
{
background: url('http://www.bbsmiley.com/styles/bbsmileyrevamped/xenforo/gradients/bg_night.png') no-repeat top center #3e597e;
}
<body{xen:if {$bodyClasses}, ' class="{$bodyClasses}"'}>
<xen:if is="{xen:time $serverTime, 'G'} >= 8 AND {xen:time $serverTime, 'G'} < 20">
<xen:set var="$shelleysBodyClass">backDay</xen:set>
<xen:else />
<xen:set var="$shelleysBodyClass">backNight</xen:set>
</xen:if>
<body{xen:if {$bodyClasses}, ' class="{$bodyClasses} {$shelleysBodyClass}"', ' class="{$shelleysBodyClass}"'}>
If I understand this correctly....
by finding:
Code:<body{xen:if {$bodyClasses}, ' class="{$bodyClasses}"'}>
replace with:
Code:<xen:if is="{xen:time $serverTime, 'G'} >= 8 AND {xen:time $serverTime, 'G'} < 20"> <xen:set var="$shellysBodyClass">backDay</xen:set> <xen:else /> <xen:set var="$shellysBodyClass">backNight</xen:set> </xen:if> <body{xen:if {$bodyClasses}, ' class="{$bodyClasses} {$shelleysBodyClass}"', ' class="{$shelleysBodyClass}"'}>
(in case you already viewed this...I edited it)
well even if it was going to work , I just realized that it won't while reading your quote...
they don't match up....
I updated that postCode:<xen:set var="$shellysBodyClass">backDay</xen:set> note: shellys class="{$bodyClasses} {$shelleysBodyClass}"', note: shelleys
Your welcome but if anything I made the error while speaking up and answering a question with a question so really thanks for persevering with me if anything.You're a star EQnoble. That worked and thanks for persevering with me forever greatful for your help.![]()
<div id="logoBlock">
<div class="pageWidth">
<div class="pageContent">
<xen:include template="ad_header" />
<xen:hook name="header_logo">
<div id="logo"><a href="{$logoLink}">
<span><xen:comment>This span fixes IE vertical positioning</xen:comment></span>
<xen:if is="{xen:time $serverTime, 'G'} >= 9 AND {xen:time $serverTime, 'G'} < 18">
<img src="styles/forge/xenforo/liveheader/header-summer-day.png" alt="{$xenOptions.boardTitle}" />
<xen:elseif is="{xen:time $serverTime, 'G'} >= 18 AND {xen:time $serverTime, 'G'} < 20" />
<img src="styles/forge/xenforo/liveheader/header-summer-sunset.png" alt="{$xenOptions.boardTitle}" />
<xen:elseif is="{xen:time $serverTime, 'G'} >= 20 AND {xen:time $serverTime, 'G'} < 6" />
<img src="styles/forge/xenforo/liveheader/header-summer-night.png" alt="{$xenOptions.boardTitle}" />
<xen:else />
<img src="styles/forge/xenforo/liveheader/header-summer-sunrise.png" alt="{$xenOptions.boardTitle}" />
</xen:if>
</a></div>
</xen:hook>
<span class="helper"></span>
</div>
</div>
</div>
@Autonamus
This is always false:
Code:<xen:elseif is="{xen:time $serverTime, 'G'} >= 20 AND {xen:time $serverTime, 'G'} < 6" />
For your purposes you would use OR:
Code:<xen:elseif is="{xen:time $serverTime, 'G'} >= 20 OR {xen:time $serverTime, 'G'} < 6" />
Hello! This is possible with @ body? As I have to do?
Sorry for my English, I'm Spanish
you could put the code? is that I know nothing about that. thanksYes. It is basically the same as the last section (Time-based header background), except you are editing PAGE_CONTAINER to conditionally apply a CSS class to the body tag. Then you can select on it using CSS.
you could put the code? is that I know nothing about that. thanks
<body{xen:if {$bodyClasses}, ' class="{$bodyClasses}"'}>
<xen:if is="{xen:time $serverTime, 'G'} >= 8 AND {xen:time $serverTime, 'G'} < 20">
<xen:set var="$tdiBodyClass">tdiBodyDay</xen:set>
<xen:else />
<xen:set var="$tdiBodyClass">tdiBodyNight</xen:set>
</xen:if>
<body{xen:if {$bodyClasses}, ' class="{$bodyClasses} {$tdiBodyClass}"', ' class="{$tdiBodyClass}"'}>
.tdiBodyDay
{
background: url('path/to/background.png') no-repeat top center #c0c0c0;
}
.tdiBodyNight
{
background: url('path/to/background_night.png') no-repeat top center #000000;
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.