Keyword

Accessing article body text in K2

  • Dingospo
  • Dingospo's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago #135331 by Dingospo
Accessing article body text in K2 was created by Dingospo
Hello, I have a joomla website which uses K2 extension. I need to know in which file in K2, the text of the article is printed?
I need to manipulate each article's test (insert some text to the end) and I can not find article body variable in any K2 php file.
Any help would be highly appreciated.

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

More
9 years 3 months ago #135345 by Lefteris
Replied by Lefteris on topic Accessing article body text in K2
Hi. The text is printed in many of the K2 template files. Probably you need to read this getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates to get familiar with K2 templates. If all you need is print some extra output in the item text you might consider developing a simple content plugin. The following links will help you:
docs.joomla.org/J2.5:Creating_a_content_plugin
docs.joomla.org/Plugin/Events/Content

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

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

  • Dingospo
  • Dingospo's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago #135353 by Dingospo
Replied by Dingospo on topic Accessing article body text in K2
Thank you very much for the answer. So, if I make the simple plugin which uses 'onContentPrepare' function, is there some specific way how to insert that plugin in K2 so the articles which were inserted by K2's article inserter become modified in certain way, when they are prepared for output?

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

More
9 years 3 months ago #135380 by Lefteris
Replied by Lefteris on topic Accessing article body text in K2
No, there is no specific way. Content plugins work the exact same way as in the core Articles system. If you want your plugin to get executed only in K2 you might want to build a K2 plugin. You can see a simple example plugin at github.com/joomlaworks/example-k2-plugin .

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