Third Party Contributions > API Based Plugins

create html in on plugin and show it in Another

(1/1)

sago:
Hi there,

I'm creating a captcha plugin in a plugin, and I need to display its html in another plugin, How can I do that, there is a way through rc api?

thanks

JohnDoh:
There are a few different ways you could do it depending on exactly what you want.

Option 1) If you maintain all 3 plugins and they will always work together then instantiate one plugin class from the other and call the method you want to generate your captcha code.

Option 2) Custom plugin hook. Your captcha plugin could attach to an event like `show_my_captcha` and your other plugin could trigger this hook.

Option 3) The render_page` hook. In your captcha plugin you could listen for the render_page hook and insert the HTML into the response.

sago:
thank a lot for your feedback,

I tried to go for 'render_page' hook, and it seems fit my case, only one more question..

I've seen, debugging code, that the html that I'm trying to fetch, is inside $this->rcmail->plugins->output['TEMPL....'] or something similar.

If I try to get this key, perhaps, rcmail return me an error. How can I retrive TEMPLOBJECT value?

Thanks in advance for your patience.

JohnDoh:
it sounds like may be either a template_object_* hook or the template_container hook might be more useful. have a look here: https://github.com/roundcube/roundcubemail/wiki/Plugin-Hooks#template-hooks

Navigation

[0] Message Index

Go to full version