Content plugins in categories (solution found!!!)

More
14 years 9 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
14 years 9 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
14 years 9 months ago - 14 years 9 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: 14 years 9 months ago by maia.

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

More
14 years 9 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.

More
14 years 9 months ago #3895 by maia
Ok. Thanks !

This code is based on joomla 1.5.15 . Never dealt with SVN but I believe this sections of joomla aren't updated that much. Therefore, working with the latest stable version might suffice.

Cheers,
Maia

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

More
14 years 9 months ago #3897 by bsky92
Thanks a lot for your contribution, I think this will help a lot of people :)

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.369 seconds
Save
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