- Posts: 20
COMMUNITY FORUM
Created date on one page, modified date on another
- Web Guy
-
Topic Author
- Offline
- Junior Member
Less
More
11 years 2 days ago #128523
by Web Guy
Created date on one page, modified date on another was created 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?
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.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
11 years 2 days ago #128524
by Lefteris
Replied by Lefteris on topic Re: Created date on one page, modified date on another
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 .
Please Log in or Create an account to join the conversation.
- Web Guy
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
11 years 2 days ago #128525
by Web Guy
Replied by Web Guy on topic Re: Created date on one page, modified date on another
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.
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.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
11 years 2 days ago #128526
by Lefteris
Replied by Lefteris on topic Re: Created date on one page, modified date on another
Is there a link to your site? What are the two dates? Are you sure that you are checking the same item?
Please Log in or Create an account to join the conversation.
- Web Guy
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
11 years 1 day ago #128527
by Web Guy
Replied by Web Guy on topic Re: Created date on one page, modified date on another
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
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.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
11 years 1 day ago #128528
by Lefteris
Replied by Lefteris on topic Re: Created date on one page, modified date on another
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.
Please Log in or Create an account to join the conversation.