test
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • obliat Friend
    #179958

    I decided to start showing creation time of my K2 items (I use teline_iv_blog class. Found them in

    templates/my template/html/com_k2/item.php and category_item.php:

    <?php $createDate = JText::_(date('d.m.Y', strtotime( $this->item->created))); ?>

    But how do I show creation time? I tried changind d.m.Y to DATE_FORMAT_LC2 which produced some odd date format.

    Then added H:i to have d.m.Y, H:i (as I saw H:i at the end of the DATE_FORMAT_LC2 definition in en_GB.ini), and it worked, but shows creation time of 3 hours back in frontend. It is Joomla related I know, but found no resolution on the internet so asking here as well.

    What is the right way to show creation time next to creation date? Please see my setup at http://www.ecars.bg if needed.

    Thanks ahead

    Martin

    Saguaros Moderator
    #464396

    Hi Martin again,

    By default, this snippet of code in K2 component helps to retrieve creation date:
    [PHP]<?php if($this->item->params->get(‘catItemDateCreated’)): ?>
    <!– Date created –>
    <span class=”catItemDateCreated”>
    <?php echo JHTML::_(‘date’, $this->item->created , JText::_(‘K2_DATE_FORMAT_LC2’)); ?>
    </span>
    <?php endif; ?>[/PHP]
    As you can see, it shall take the K2_DATE_FORMAT_LC2 format which you can find easily in language file for K2 component such as: /language/en_GB/en-GB.com_k2.ini

    K2_DATE_FORMAT_LC2="%A, %d %B %Y %H:%M"
    It shows date and time already. Please check again.

    obliat Friend
    #464439

    Hi Saguaros,
    thanks for your explanation, but please see attached file – time is not there, only date – or clich any of the articles on http://www.ecars.bg frontpage and you’ll see it missing. Please let me know where on my website do you see time showing up.

    So like I said I managed to make it show up modifying templates/my template/html/com_k2/item.php and category_item.php as only changing these files works, where date is set as simple ‘d.m.Y’, not K2_DATE_FORMAT_LC2. I tried changing d.m.Y to K2_DATE_FORMAT_LC2 and I got:

    K2_SatAMEESTE_August+0300RAugAMEEST (you see how weird this is).

    So making it d.m.Y, H:i works, but shows creation time 3 hours back…

    Still no solution for me on this

    obliat Friend
    #464460

    Forgot the image – here 🙂


    1. time
    Saguaros Moderator
    #464481

    Hi Martin,

    If it shows creation time 3 hours back, please check the server time zone whether it’s correct or not.

    obliat Friend
    #464580

    I have time set to my local zone, but despite it shows 3 hours back when I use this H:i suffix, which I’m not sure I have to so that’s why I asked you what the code should look like based on above posts info. It’s not K2 related matter, because it is controlled by the K2 files in the template folder which I believe are Joomlart files you know so that’s why I need your help.

    Thanks again.

    Saguaros Moderator
    #464651

    Dear Martin,

    PM me admin and FTP account, I shall check this for you.

    obliat Friend
    #465325

    Thanks, PM sent – I’ll keep an eye 😉

    valtersgrivins Friend
    #465368

    I would be happy to get 3 hours back problem solution as well. Posted a thread 2 days ago, but no answer.

    Saguaros Moderator
    #465833

    Hi all,

    Apologies for this late response,

    I forgot to know where should I access to reproduce this issue cause I’m not good at your language. Which menu item should I access? and this menu item retrieves Joomla or K2 content?

    obliat Friend
    #465869

    No worries,

    so on http://www.ecars.bg click any of the articles in the JA News Featured module or blog view articles below – there is ONLY K2 items on my website – no Joomla content.

    So, once you open K2 item you see time of publication under the title. When I add H:i to templates/my template/html/com_k2/item.php and category_item.php, because I found the time being set in those two files, I manage to show the time, but it shows 3 hours back. For example if you look at the end of the article you’ll see Last modified time shows time and shows it correctly.

    And here’s the catch – I think I understand where the issue is and you’re right that I need to use K2_DATE_FORMAT_LC2 (or simply DATE_FORMAT_LC2), but

    in templates/my template/html/com_k2/item.php and category_item.php for item date create the code is

    <!-- Item create date -->
    <div class="month-year">
    <span><?php echo JText::_('K2_ON'); ?></span>
    <?php $createDate = JText::_(date('d.m.Y,', strtotime( $this->item->created))); ?>

    and for item date modified code is

    <?php if($this->item->params->get('itemDateModified') && intval($this->item->modified)!=0):?>
    <!-- Item date modified -->
    <?php if($this->item->created != $this->item->modified): ?>
    <span class="itemDateModified">
    <?php echo JText::_('K2_LAST_MODIFIED_ON'); ?> <?php echo JHTML::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC2')); ?>
    </span>
    <?php endif; ?>
    <?php endif; ?>

    So I can’t simply change d.m.Y to DATE_FORMAT_LC2 as it’s strotime controlled. On the other hand item date modified has DATE_FORMAT_K2 and shows the time flawlessly.

    So I think the code for item date created needs to be changed if possible.

    Ninja Lead Moderator
    #466283

    nice work.

    obliat Friend
    #467078

    Saw there’s a response and thought “Hey, someone found a decision for me” 😀 but I’m still relying on you about this guys as I haven’t figured it yet. Thanks and let me know what you think.

    Ninja Lead Moderator
    #467092

    @obliat: Thanks for the feedback. FYI – I have raised this issue and request the fix to our development team here.

    We’ll soon have this fix for the next release!

    Regards.

    obliat Friend
    #467121

    Awesome guys, and a good reason to say Thank You! 🙂

Viewing 15 posts - 1 through 15 (of 16 total)

This topic contains 16 replies, has 4 voices, and was last updated by  obliat 12 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum