i modified blog_item.php to display fulltext in category blog layout. Works fine, but the content plugins are not rendered. They are rendered fine in introtext. Can anyone help me with the right code to be able to render the content plugins in fulltext?

// using this code to display fulltext
$itemID =  $this->item->id;
$db =& JFactory::getDBO();
$query = "
SELECT `fulltext` 
FROM `#__content` 
WHERE `id` = $itemID;
$fulltext = $db->loadResult();

I have found this piece of code to render the content plugins, but can't get it to work with fulltext:

$dispatcher = JDispatcher::getInstance();
$results = $dispatcher->trigger('onContentPrepare', array ('com_content.category', &$item, &$this->params, 0));
| improve this question | | | | |
  • 1
    I don't understand why you modified the php file. By not adding a readmore line, fulltext is displayed by default. Were the content plugins not triggering? – Toni Marie Nov 8 '14 at 14:34
  • I need 2 separate blocks of text for every entry in blog layout. I'm using introtext and fulltext separately. Content plugins works fine with introtext, but not with my fulltext modification. – Dan Nov 8 '14 at 20:53
  • Speaking from experience, rather than a core hack I'd probably write a custom CSS class that I apply via the editor dropdown (you're using JCE, right?) and that would have the same result as the single click to insert the readmore. – Toni Marie Nov 8 '14 at 20:58
  • Agree with @Toni, there's no need to do this. Don't add a readmore and your fulltest is the introtext. – Seth Warburton Nov 10 '14 at 10:04
  • As you can read in the documentation here docs.joomla.org/Plugin/Events/Content#onContentPrepare, onContentPrepare needs the property "text" in your $item – Dayron Gallardo Nov 10 '14 at 16:05

Don't edit the blog_item.php just create a template override.

this is how you get to render content plugin in content fulltext:

$full_text = JHTML::_('content.prepare', $fulltext);
// see it in var_dump($full_text); 

You will get error if there are plugins that overriding your articles display, i.e : DISQUS comment Plugin by JoomlaWorks. So you must edit(or override) that plugin views template instead. (not the blog_item.php).

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.