Форуми / Cotonti / Core Labs / Archive / A few enhancements to plugins

AJAX mode, multiple standalone parts, etc.

Trustmaster
#1 18.12.2008 17:44
In Seditio if you call plug.php?r=yourplug that would call a file from plugins/code/yourplug.php as a standalone without header/footer. I think we need to improve this to be used for AJAX-mode plugins.

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?
May the Source be with you!
Lombi
#2 18.12.2008 19:43
Sounds perfect. Executing these without header and footer would solve so many problems it hurts to think :)
<a href="http://www.domenlo.com">Surreal Art</a>
Trustmaster
#3 19.12.2008 01:47
Done, added AJAX parts support for plugin. How to use them:
[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
  • May the Source be with you!
    esclkm
    #4 19.12.2008 01:53
    i can say only wow.
    littledev.ru - мой маленький зарождающийся блог о котонти.
    снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
    Dayver
    #5 19.12.2008 02:33
    I verify. It works perfectly. Now not must put at the root any different files
    Pavlo Tkachenko aka Dayver

    Відредаговано: Dayver (19.12.2008 02:45, 15 років тому)
    esclkm
    #6 19.12.2008 05:02
    Can you give your example plugin?
    littledev.ru - мой маленький зарождающийся блог о котонти.
    снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
    Trustmaster
    #7 19.12.2008 05:18
    See latest markitup plugin.
    May the Source be with you!
    Brock
    #8 19.12.2008 06:00
    Very interesting. Will be checking this out soon. Was quite a good idea.
    Web Design Database - www.wddb.com