-
AuthorPosts
-
obliat Friend
obliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 15, 2012 at 9:46 pm #179958I 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 ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
August 16, 2012 at 8:35 am #464396Hi 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 Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 16, 2012 at 4:18 pm #464439Hi 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 Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 16, 2012 at 7:49 pm #464460Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
August 17, 2012 at 3:38 am #464481Hi Martin,
If it shows creation time 3 hours back, please check the server time zone whether it’s correct or not.
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 17, 2012 at 7:02 pm #464580I 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 ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
August 20, 2012 at 1:22 am #464651Dear Martin,
PM me admin and FTP account, I shall check this for you.
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 25, 2012 at 11:57 am #465325Thanks, PM sent – I’ll keep an eye 😉
valtersgrivins Friendvaltersgrivins
- Join date:
- February 2008
- Posts:
- 38
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 6
- Thanked:
- 1 times in 1 posts
August 26, 2012 at 9:55 am #465368I would be happy to get 3 hours back problem solution as well. Posted a thread 2 days ago, but no answer.
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
August 30, 2012 at 10:37 am #465833Hi 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 Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 30, 2012 at 9:02 pm #465869No 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 ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 6, 2012 at 3:07 am #466283nice work.
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
September 14, 2012 at 9:21 pm #467078Saw 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 ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
September 16, 2012 at 6:08 am #467121Awesome guys, and a good reason to say Thank You! 🙂
AuthorPostsThis 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