Foren / Cotonti / Core Labs / Archive / Plugin.php HEADER/FOOTER Generation

Lombi
#1 4. August 2008, 19:18
It would be very useful if Cotonti would have a way of turning off header/footer generation for plugins if a plugin needs to operate outside of this like:

xml files
xml sitemaps
robots.txt
anything else

Your thoughts?
<a href="http://www.domenlo.com">Surreal Art</a>
Orkan
#2 15. August 2008, 17:34
This can be done via plugins/code then you call your plugin with: plug.php?r=myplugin


..but what is more important...
I got a site with a lot of ajax stuff and the current common.php istn practical at all.
Sometimes I need access to DB only, another time I need DB + user rights only.
The biggest problem is the ob_start('ob_gzhandler'); - you cant redo the gzip compression if not needed (eg, when outputting big JPG files it takes years to compress it)

My idea is to split common.php file into 3 if - else parts - driven by an GET param. Right now I use external php files with only parts from common.php - really odd :p
Perl - the only language that looks the same before and after RSA encryption.
Trustmaster
#3 15. August 2008, 20:01
Take a look on "modules" in Coding Guide. This feature actually existed for ages in Seditio and Asmo can show you an example how to create top-level modules for Seditio, we just need to make it more coder and user friendly.

As for gzhandler, could define some constant in the beginning of main file and check it in common.php:
define('SED_NOGZIP', true);
require_once('./system/common.php');
in common.php:
if(!defined('SED_NOGZIP'))
{
// Switch gzip on, etc.
}
May the Source be with you!
Orkan
#4 16. August 2008, 04:48
Well, I will have to look closer at this whole modules idea - its not clear for me atm.
Do I need modules for simple AJAX calls in my plugins?
define('SED_NOGZIP', true);
require_once('./system/common.php');
ok, but where to define this?

I had thought about something similar to plug.php?r=myplugin with two differences.
1. It'll pick php files from /plugins/ajax dir instead (or better /plugins/myplugin/ajax/ - for better integrity)
2. An additional param in URL will tell the system where to leave common.php and go to your plugin code.

Example of URL's with additional param 'c':

a) $.get("plug.php?x=myplugin&c=short" ... only basic DB support (good for RSS feeds, etc...)
b) $.get("plug.php?x=myplugin&c=medium" ... DB + auth
c) $.get("plug.php?x=myplugin" ... similar to: plug.php?r=myplugin

Its rough but I hope you'll get the idea
Perl - the only language that looks the same before and after RSA encryption.
Trustmaster
#5 16. August 2008, 05:36
Right, need something like that for smaller plugins. More ideas what's required for better AJAX support?
May the Source be with you!