Fork me on GitHub

add time and date to theme  Bottom

  • I have http://www.fa2000-98a.dk/

    I would like to add time and date to the theme. It should be in the same bar as the "Home", "Search" and "Account Panel" but to the far right.

    Is that possible?
  • Absolutely you can
    I did that last night icon_razz

    you can use the datetime Theme plugin:

    Code

    * Smarty function to display the current date and time
     *
     * Example
     * <!--[datetime]-->
     *
     * <!--[datetime format='_DATEBRIEF']-->
     *
     * <!--[datetime format='%b %d, %Y - %I:%M %p']-->
     *
     *  Format:
     * _DATEBRIEF       '%b %d, %Y'
     * _DATELONG        '%A, %B %d, %Y'
     * _DATESTRING      '%A, %B %d @ %H:%M:%S'
     * _DATETIMEBRIEF   '%b %d, %Y - %I:%M %p'
     * _DATETIMELONG    '%A, %B %d, %Y - %I:%M %p'


    Call the plugin into the navigation menu of your andreas08 theme.
    Check the /templates/master.htm and /templates/modules/home.htm files.
    Around line 21 you'll see the menu code:

    Code

    <div id="theme_navigation_bar">
    <ul>
    <li><a href="<!--[pngetbaseurl]-->"><!--[pnml name="_ANDREAS08_HOME"]--></a></li>
    <li<!--[if $module eq 'Search']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Search]-->"><!--[pnml name="_SEARCH"]--></a></li>
    <li<!--[if $module eq 'Profile']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Profile]-->"><!--[pnml name="_YOURACCOUNT"]--></a></li>
    </ul>
    </div>


    Insert the new "option" for the date with the plugin call:

    Code

    <div id="theme_navigation_bar">
    <ul>
    <li><a href="<!--[pngetbaseurl]-->"><!--[pnml name="_ANDREAS08_HOME"]--></a></li>
    <li<!--[if $module eq 'Search']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Search]-->"><!--[pnml name="_SEARCH"]--></a></li>
    <li<!--[if $module eq 'Profile']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Profile]-->"><!--[pnml name="_YOURACCOUNT"]--></a></li>
    <li><!--[datetime format='%b.%d.%Y - %I:%M %p']--></li>
    </ul>
    </div>


    You may wish add some inline styling to the date "option":

    Code

    ...
    <li s t y l e="float:right; border:none; padding: 0 10px"><!--[datetime format='%b.%d.%Y - %I:%M %p']--></li>
    </ul>
    </div>
    (change "s t y l e" to "style")

    Hope it helps!
    and enjoy the Zikula Theme engine icon_wink



    edited by: nestormateo, Sep 23, 2008 - 06:43 AM

    --
    - Mateo T. -
    Mis principios... son mis fines
  • THANKS....i almost got it rigth icon_wink

    The date is now visibel and in the right form. BUT the HOUR is 1 hour to slow. Cant that be corrected?

    Also, i would like to move the date/time to the far right. Is that what you described in the part below this? Cause im not sure where to do this.



    Quote

    You may wish add some inline styling to the date "option":
    Code

    ...




    (change "s t y l e" to "style")


  • GOT IT !!!!!

    I just have to learn how to read, what peoble writes icon_biggrin

    Only issue now, is the missing hour. Can it be fixed?



    edited by: gotskov, Sep 23, 2008 - 01:36 PM
  • Have you fixed it? i see the hour there.
    Just read this and build the format string with the specifiers that you need
    icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • nestormateo

    Have you fixed it? i see the hour there.
    Just read this and build the format string with the specifiers that you need
    icon_wink


    Yes and no.

    I got what i want and where i want it. So thats great.

    But i still miss an hour. Right now, the time is right, but its because i changed the timezone in zilula, so im right now living in london instead of copenhagen.

    BTW Mateo, I really appriciate all the help you are providing. I would never be able to do al this without you help..... You have all my respect!!!





    edited by: gotskov, Sep 23, 2008 - 08:23 PM
  • Mmmmm
    if unregistered, Zikula uses the site's timezone (Admin > Settings > Locale settings tab),
    if logged in, uses the User's timezone.

    So, you need to modify the site's config?



    edited by: nestormateo, Oct 07, 2008 - 03:51 PM

    --
    - Mateo T. -
    Mis principios... son mis fines
  • nestormateo

    Mmmmm
    if unregistered, Zikula uses the site's timezone (Admin > Settings > Locale settings tab),
    if loggued int, uses the User's timezone.

    So, you need to modify the site's config?


    Seems that I never ended this one....sorry!!!

    But you were almost rigth. The server time was fine. It was my own account, which had the wrong timezone

    icon_redface

This list is based on users active over the last 60 minutes.