Keyword

Icon when when an article has been updated

  • Aniron79
  • Aniron79's Avatar Topic Author
  • Offline
  • New Member
More
6 months 23 hours ago #172353 by Aniron79
Aniron79 created the topic: Icon when when an article has been updated
Hi, is there a way to make an icon appear in the title when an article has been updated?

Thanks

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 3 weeks ago #172371 by Fotis
Fotis replied the topic: Icon when when an article has been updated
Use this:
<?php $updated = ($this->item->modified) ? true : false; ?>

Then check for $updated and attach an extra CSS class or message next to the item title.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Aniron79
  • Aniron79's Avatar Topic Author
  • Offline
  • New Member
More
5 months 3 weeks ago #172383 by Aniron79
Aniron79 replied the topic: Icon when when an article has been updated
in which file should I enter the code?

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 3 weeks ago #172384 by Fotis
Fotis replied the topic: Icon when when an article has been updated
You first need to create a set of template overrides inside your Joomla template, for K2, so you won't lose your changes in the future (when you upgrade K2).

See here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

You'll then need to edit item.php and category_item.php for component views and mod_k2_content's default.php for module views.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Aniron79
  • Aniron79's Avatar Topic Author
  • Offline
  • New Member
More
5 months 3 weeks ago #172385 by Aniron79
Aniron79 replied the topic: Icon when when an article has been updated
Thank you so much!

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 3 weeks ago #172389 by Fotis
Fotis replied the topic: Icon when when an article has been updated
You're welcome.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

More
4 months 2 weeks ago #172630 by Chris Hogan
Chris Hogan replied the topic: Icon when when an article has been updated
In regard to this code below, am I placing it in and around the <!-- Start K2 Item Layout --> area on the subtemplate item file?

Also, where can I write the words 'Updated News' in the code as well??

Any help will be great!

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
4 months 2 weeks ago #172635 by Fotis
Fotis replied the topic: Icon when when an article has been updated
This is part of the actual item output, so you either edit the category_item.php file (in the K2 sub-templates) for the item output in category listings or item.php for the direct item output.

If you choose item.php for example, you place the code wherever you like. Something like:
<?php $updated = ($this->item->modified) ? true : false; ?>
<?php if ($updated): ?>
<b>The article was recently updated!</b>
<?php endif; ?>

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

More
4 months 2 weeks ago - 4 months 2 weeks ago #172648 by Chris Hogan
Chris Hogan replied the topic: Icon when when an article has been updated
Ok great that works ok with just the words in my item.php...

I just need to figure out how to have it appear for only recently modified items (within the past 2 weeks or so)

As per my other post, I read through the post about 'Publishing date in item and category listings' you mentioned and believe I need something like this below?

<?php echo JHTML::_('date', $this->item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?>
Last edit: 4 months 2 weeks ago by Chris Hogan.

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

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
4 months 1 week ago #172664 by Fotis
Fotis replied the topic: Icon when when an article has been updated
You need to convert the modified date to a unix timestamp (using e.g. strtotime($this->item->modified)) and do the same with the current time (strtotime("now")). Subtract the modified unix timestamp from the current time (also in unix timestamp) and if the difference is smaller than 2 days (divide the difference with the number of seconds contained in 2 days - 60* 60 * 24 * 2) then show a different message.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum