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

UserBar Date/Time

#1
So, I've got a date/time box from some website, I can get it to fit in properly in the UserBar for normal users, but for people that can see the moderator bar it looks like arse. Forgive me if it's something completely stupid, the userbar template looks like this:
Code:
<xen:require css="user_bar.css" />
 
<fieldset id="userBar">
    <div class="pageWidth">
        <div class="pageContent">
            <xen:if is="{$visitor.user_id} && !{$visitor.is_moderator} && !{$visitor.is_admin} && @showUserBarText">
                <a href="@userBarTextLink">
                    <span class="itemLabel">@userBarString</span>
                </a>
            </xen:if>
                        <span style="display:inline-block;height:0px;line-height:13px;vertical-align:middle;">
                        <iframe src="http://free.timeanddate.com/clock/i3gdg2jt/tluk/fn17/fs12/fcd7edfc/tct/pct/tt0/tw1/tm1/td1/th2/ta1/tb1" frameborder="0" width="219" height="16" allowTransparency="true"></iframe>
                        </span>
                        <xen:if is="{$visitor.is_moderator} || {$visitor.is_admin}">
                <xen:include template="moderator_bar" />
            </xen:if>
            <xen:if is="{$visitor.user_id}"><xen:include template="navigation_visitor_tab" /></xen:if>
        </div>
    </div>
</fieldset>
(I know I just mash together code until it looks how I want but it works so don't pay attention to the fact it looks horrible :p)
For moderators it looks like this:
Capture2.PNG
And for normal users this:
Capture.PNG
~Thanks.
 
#3
I'm not sure about the styling, but this add-on I created might be useful:

http://xenforo.com/community/resources/display-utc-time-helper.1040/

It would enable you to just type this text directly into the template to generate the time and date: {xen:helper utctime, date}

It doesn't automatically update until the page is refreshed, but it might be a cleaner way than doing it with an iframe.
Sounds like a great alternative, but I need to have it updating without a refresh.
 

Chris D

XenForo developer
Staff member
#6
This works perfectly for me:

Code:
<span class="itemLabel">
	<iframe src="http://free.timeanddate.com/clock/i3gdg2jt/tluk/fn17/fs12/fcd7edfc/tct/pct/tt0/tw1/tm1/td1/th2/ta1/tb1" allowtransparency="true" style="height: 16px; vertical-align: top; width: 219px; border: none;"></iframe>
</span>
Note I've removed a few parameters from the iframe in place of using style.
 
#7
This works perfectly for me:

Code:
<span class="itemLabel">
<iframe src="http://free.timeanddate.com/clock/i3gdg2jt/tluk/fn17/fs12/fcd7edfc/tct/pct/tt0/tw1/tm1/td1/th2/ta1/tb1" allowtransparency="true" style="height: 16px; vertical-align: top; width: 219px; border: none;"></iframe>
</span>
Note I've removed a few parameters from the iframe in place of using style.
I copied and pasted that and everything on my site disappeared except for the background and the clock :/