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

UserBar Date/Time

Discussion in 'Styling and Customization Questions' started by Zovator, Jan 11, 2013.

  1. Zovator

    Zovator Member

    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.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  3. Zovator

    Zovator Member

    Sounds like a great alternative, but I need to have it updating without a refresh.
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    Fair enough :)

    You might want to add: class="itemLabel" to your span tag.
     
  5. Zovator

    Zovator Member

    I tried that before and removed it because it did nothing.
     
  6. Chris D

    Chris D XenForo Developer Staff Member

    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. Zovator

    Zovator Member

    I copied and pasted that and everything on my site disappeared except for the background and the clock :/
     
  8. Chris D

    Chris D XenForo Developer Staff Member

    I edited my post quite quickly after I posted it as I noticed I made a mistake.

    Try it again.
     
  9. Zovator

    Zovator Member

    Worked, thanks. I decided that I hated the clock idea afterwards though xD
     

Share This Page