Keyword

Created date on one page, modified date on another

  • Web Guy
  • Web Guy's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 4 months ago #128523 by Web Guy
I have a blog style layout. On the blog page that lists all the stories, it displays the Created date. That's fine.

When you click into the story to view the item, it now shows the Modified date at the top, not the created date.

User.php uses this code
<?php if($this->params->get('userItemDateCreated')): ?>
<!-- Date created -->
<span class="userItemDateCreated">
<?php echo JHTML::_('date', $item->created , 'F d, Y'); ?>
</span>
<?php endif; ?>

item.php uses this code
<?php if($this->item->params->get('itemDateCreated')): ?>
<!-- Date created -->
<span class="itemDateCreated">
<?php echo JHTML::_('date', $item->created , 'F d, Y'); ?>
</span>
<?php endif; ?>

I am modifying the default template files of the above. I do not know why it is showing 2 different dates, when the code is ->created in both instances?

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #128524 by Lefteris
Hi. Are you viewing the same item? Are you editing the right files? Also note that editing directly the K2 templates is not a good idea. You should create overrides instead. More information on this can be found at getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates .

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Web Guy
  • Web Guy's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 4 months ago #128525 by Web Guy
Hi

Yes, I understand about template overrides and so does the client, we won't be updating K2 for a while.

Yes, we are editing the correct files. I have changed the line...

<span class="userItemDateCreated">

To a different class and can see it make the change in the correct pages. I just cannot see why it is picking/using 2 different dates.

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #128526 by Lefteris
Is there a link to your site? What are the two dates? Are you sure that you are checking the same item?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Web Guy
  • Web Guy's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 4 months ago #128527 by Web Guy
Here is the link...

www.bartonmawer.com/index.php/latest-news-from-barton-mawer-motorsport.html

First story.

The date shown in the blog list is the created date, the date shown in the full item view, is the last modified date.

yes it is the same item.

Cheers

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #128528 by Lefteris
I just tested under J3.3 and everything works fine for me. Check for any third-party K2 or content plugins. Also check again your overrides.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum