NYCPHP Meetup

NYPHP.org

[joomla] enabling plugins in extensions

Gary Mort garyamort at gmail.com
Thu Apr 22 11:35:29 EDT 2010


That code there is for a find/replace function.

Basically, what happens is when Joomla runs the a plugin, a lot of plugins
will go and check the html that has been generated for the keystring and
then replace everything in the {} with the results of a script.

However, such plugins have to actually be triggered by an event in order to
run.  I'm guessing this is a content plugin?  Content plugins are only run
by the content component and components that have been specifically enabled
in their code to run them.

Here is a good article on various plugin magic and how to work around these
limitations:
http://www.howtojoomla.net/how-tos/development/how-to-fix-joomla-content-plugins

The SHORT summary would be to do the following:

$findSnapshot =
"{product_snapshot:id=$prod_id,showname=n,showprice=n,showdesc=n,showaddtocart=y}";

JHTML::_('content.prepare', $findSnapshot);

This should trigger the content plugins and generate the html you are
looking for.

-Gary

On Thu, Apr 22, 2010 at 10:39 AM, Mark Simko <masimko at verizon.net> wrote:

>  I want to use a plugin in an extension. Specifically, I'm trying to use
> the virtuemart product snapshot plugin in a vmproductfinder search results
> page. I paste this into the searchresults.php file:
>
> {product_snapshot:id=<?php
> echo($prod_id);?>,showname=n,showprice=n,showdesc=n,showaddtocart=y}
>
> And I get basically the same thing (with the correct product number) in my
> results page.
>
> So, plugins are not being processed when this extension is used. The plugin
> is enabled in the plugin manager. There are no parameters that turn on
> plugin processing for this search extension.
>
> Is there anything I can do to make plugins be processed when this file is
> used to generate the output? I need this plugin to have an add to cart
> button on the page next to the search results.
>
> Thanks in advance for any help.
>
> Mark
>
> _______________________________________________
> New York PHP SIG: Joomla! Mailing List
> http://lists.nyphp.org/mailman/listinfo/joomla
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>



-- 
----
Hudson Valley Sudbury School
What GPL is for application users
Our school is for students
Help your children grow, change, and learn
Let your child direct, control, amend
Check out http://www.sudburyschool.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/joomla/attachments/20100422/96d5dff3/attachment.html>


More information about the Joomla mailing list