cotonti.com : A few enhancements to plugins https://www.cotonti.com Son konu mesajları Cotonti en Fri, 28 Nov 2025 20:44:20 -0000 Brock Cum, 19 Ara 2008 06:00:32 -0000 Trustmaster Cum, 19 Ara 2008 05:18:57 -0000 esclkm Cum, 19 Ara 2008 05:02:37 -0000 Dayver Cum, 19 Ara 2008 02:33:07 -0000 esclkm Cum, 19 Ara 2008 01:53:44 -0000 Trustmaster [list=1]
  • Create a part of the plugin, e.g. my_plug.ajax.php (could be any other name as well).
  • Set its Hook=ajax.
  • Code it just as a normal plugin, keeping in mind that it has not called header.php and footer.php. You can also set HTTP headers there with header() function before you send any output.
  • Use it this way: plug.php?r=my_plug
  • ]]>
    Cum, 19 Ara 2008 01:47:35 -0000
    Lombi Per, 18 Ara 2008 19:43:56 -0000 Trustmaster
    AJAX-mode parts of plugins are standalone, without header/footer, without some code in common.php. They should use hook "ajax" and be called this way: plug.php?r=yourplug which will call plugins/yourplug/yourplug.php.

    I also propose having multiple "executable" parts of the plugin. For example, if your plugin "my_plugin" contains a standalone part "my_plugin.php" you call it like plug.php?e=my_plugin. At the same time it contains a popup part "my_plugin.popup.php" which can be called like plug.php?o=my_plugin. And finally an AJAX part "my_plugin.ajax.php". So, the name of the part also tells how it can be executed. Alternatively, there could be a parameter to choose a part of plugin when calling: plug.php?r=my_plugin&p=ajax.

    What do you think?]]>
    Per, 18 Ara 2008 17:44:52 -0000