Content plugins in categories (solution found!!!)

More
15 years 11 months ago - 15 years 11 months ago #3827 by maia
Hi all !

Well, I'm having this problem. I can make joomla plugins work with flexicontent items, but it looks like it doesn't work with categories.

Excuse my ignorance, still learning flexicontent. Great software !

Any help on this would be greatly appreciated.


This issue has been resolved already. Excuse the redundancy but i'll post the final code you'll need to insert in its respective file. Nevertheless, you should read the whole thing.
Code:
$category =& $this->get('Category'); $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $category->text = $category->description; $results = $dispatcher->trigger('onPrepareContent',array (& $category, & $category->params, 0)); $category->description = $category->text;

Cheers,
Maia
Last edit: 15 years 11 months ago by maia.

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

More
15 years 11 months ago #3829 by orchid1
what plugins are you using?

“Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.” William A. Foster - USMC

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

More
15 years 11 months ago #3831 by maia
I've tried with just a simple plugin like {backbutton} on the page with no avail. Initially I was trying with mosmap and it doesn't work as well.

When I insert the plugins in Flexycontent Items it works flawlessly.

I've enable content plugins inside the "description" field and the field is in the template.

Again ... it's weird. It works with Items but no with Categories.

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

More
15 years 11 months ago #3834 by maia
I just tried using the {loadposition} plugin and it doesn't work. Tried with "modules anywhere" and javascript is not loaded.

Remember I'm just referring to the articles you insert in the categories. Items seem to work well.

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

More
15 years 11 months ago #3837 by orchid1
unfortunately FLEXIcontent doesn't support all the plugins that regular joomla supports there is another thread on this Ill try to find it and post it here

“Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.” William A. Foster - USMC

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

More
15 years 11 months ago #3853 by maia

orchid1 wrote: unfortunately FLEXIcontent doesn't support all the plugins that regular joomla supports there is another thread on this Ill try to find it and post it here


Thanks. I really appreciate that.

But anyway, do you really think flexicontent doesn't support this plugins ? They work with flexicontent items but not with flexicontent categories. So they ARE supported ... at least, partially.

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

More
15 years 11 months ago #3854 by maia
Found this in the changelog file:

"+ Allow content plugins to be triggered on category views as well"

Well, I think that's what i need but it seems it's not working.

Can any of the devs give some hint on how can I fix this ?

Help ...

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

More
15 years 11 months ago #3860 by maia
More on this:

file com_flexicontent/views/category/view.html.php

It has a commented piece of code :cry: :
Code:
$item->event = new stdClass(); $results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0)); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0)); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0)); $item->event->afterDisplayContent = trim(implode("\n", $results));

This has definitely something to do with loading plugins. Tried uncommenting but the result is the same: nothing. Then I debugged com_content/views/category/view.html.php to see how it loads plugin. The code is almost the same except it triggers content plugins like this:
Code:
JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0));

Just before a piece of code very similar to flexicontents view.html.php . The result: a blank page. Most probably due to an error. Hope I'm of any help.

Either way, content plugins triggers aren't working with categories descriptions.

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

More
15 years 11 months ago - 15 years 11 months ago #3861 by maia
Done ! Needs more tests when inserting loadposition but i've tested it with backbutton and google_map (mosmap2) plugins and it works.

Just find the text in com_flexicontent/views/category/view.html.php
Code:
// just a try : to implement later

Just bellow the commented code block (you can replace it as well) add this piece of code and voilá ! Plugins are triggered just like in standard joomla categories/sections .
Code:
$category =& $this->get('Category'); $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $category->text = $category->description; $results = $dispatcher->trigger('onPrepareContent',array (& $category, & $category->params, 0)); $category->description = $category->text;

Hope it helps ! :D and btw, now the changelog is really correct ... :twisted:
Edit:

I've removed the "foreach" piece of code as it is not necessary. The code block above reflects the final version of this hack.
Last edit: 15 years 11 months ago by maia.

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

More
15 years 11 months ago #3891 by orchid1
thanks for the response on this I'm sure this will help some people out.
Have you tried the Joommla SVN?
you might want to see if this is included in the latest version

“Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.” William A. Foster - USMC

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

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save