Keyword

[SOLVED] Estimated Reading Time plugin How to adapt K2

  • Valentine Solo
  • Valentine Solo's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago #160335 by Valentine Solo
Estimated Reading Time plugin How to adapt K2 was created by Valentine Solo
K2 is truly flexible thing! This time I've tried to implement Joomla Estimated Reading Time Plugin for K2 articles but... it doesn't work out of the box.
May be community can help?

As follows from doc reference, to use it on overrides templates we should add the following:

$this->item->readingtime->slowtime : The slower time your users might take reading the article
$this->item->readingtime->quicktime : The quicker time your users might take reading the article
$this->item->readingtime->formattedtime : The plugin output, which you can override using directions in previous section.
$this->item->readingtime->wordCount (Since 3.5.1) : The number of words in the article


But default.php of this plugin is just all about com content. I'd like to use it in K2 and appreciate any tips.

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
7 years 7 months ago #160347 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Estimated Reading Time plugin How to adapt K2
Hi Valentine,

I have looked into the code of the plugin, it is restricted to work with Joomla articles only, so you need to modify it to work with K2.

Edit the readingtime.php file, and the required if conditions to work with K2, just like $context == 'com_k2.item' and/or $context == 'com_k2.itemlist'

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #160373 by Krikor Boghossian
Replied by Krikor Boghossian on topic Estimated Reading Time plugin How to adapt K2
There are several JS plugins which offer the same functionality and will work with any CMS/ extension.

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

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

  • Valentine Solo
  • Valentine Solo's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago #160479 by Valentine Solo
Replied by Valentine Solo on topic Estimated Reading Time plugin How to adapt K2

Mohamed Abdelaziz wrote: Hi Valentine,

I have looked into the code of the plugin, it is restricted to work with Joomla articles only, so you need to modify it to work with K2.

Edit the readingtime.php file, and the required if conditions to work with K2, just like $context == 'com_k2.item' and/or $context == 'com_k2.itemlist'


Just the thing I needed. Thanks. Now It is clear and easy)

As conclusion:
if ($context == 'com_content.article' || $context == 'com_content.featured' || $context == 'com_content.category' || $context == 'com_k2.item')

Or to use js to get the same value of reading time.

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


Powered by Kunena Forum