plugin confuses s9y

Creating and modifying plugins.
Post Reply
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

plugin confuses s9y

Post by romulus »

Hi,

I'm writing my first plugin right now and have a problem with it ;)

I try to include a random photo from my gallery installation. There exists a php file block-random.php that opens the gallery album, *does some stuff* and echoes some html to display a random photo. I had written a plugin for wordpress and this worked perfectly.
The basics of my plugin for s9y are working right now, but some of this "does some stuff" that random-block.php does confuses s9y. F.i. in the plugin list of admin area all images of the arrows are not loaded anymore after this plugin. And the complete list of event plugins is empty, not one event plugin is there, but the event plugins are working when I load my mainpage.
When I try to move my new plugin up or down, the order gets totally messed up, other plugins are moved mysteriously to another order !?
When I load my mainpage, my new plugin is working, the photo is displayed as intended, but all other plugins that are placed after my plugin, are not working properly anymore. Like in plugin list, all images are not shown, because in source code there is no URL for the image given. Also the category plugin returns an empty category list. And so on ...

That all seems to be because the gallery seems to be doeing something that s9y doesn't like. If I comment out the call to random-block.php (include ../gallery/block-random.php) all is fine and s9y is working as ever, but naturally no photo anymore. So at least it seems to be not my fault with the plugin itself, instead its the gallery.

Can someone explain this to me? Or give me some hints?

my plugin: http://www.romulus23.de/s9y/uploads/rom ... yembed.txt
block-random.php: http://www.romulus23.de/s9y/uploads/block-random.txt
init.php (init file of gallery that gets called by random-block): http://www.romulus23.de/s9y/uploads/init.txt
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: plugin confuses s9y

Post by garvinhicking »

Hm, that indeed sounds strange. I suppose if you look at the HTML output of your plugin admin panel, you will find out that your gallery plugin shows some code? You need to move the inclusion of the PHP file outside of the generate_content() function, since that one is also called on the admin panel...

Sadly the links you specified do not work, they only lead me to your startup page :-)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
romulus
Regular
Posts: 49
Joined: Fri Sep 24, 2004 4:31 pm
Contact:

Post by romulus »

they don't work anymore because at the time I wrote this I only had a test installation and now I have a full productive s9y running. ;)

The links look now like this:

http://www.romulus23.de/s9yold/uploads/ ... yembed.txt
http://www.romulus23.de/s9yold/uploads/block-random.txt
http://www.romulus23.de/s9yold/uploads/init.txt

Why do I have to move the inclusion of the php outside of the generate_content function? I want to display the output of this php as content of the plugin and so I need to include this file in generate_content :?: Or how should I include this php file and include the output of it as content?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

As a first test, try use this inside your PHP plugin:

Code: Select all

if (!isset($serendipity['no_events']) || $serendipity['no_events'] === FALSE) {
 include 'block-random.php';
}
Since the no_events variable is set when the admin panel calls up, this should enforce to not execute the plugin. I do suppose that Gallery messes with some global variable space or similar? Haven't yet looked into its embedded use. :(

I suppose you need to go through the files included by gallery and then comment out parts of it (or die()ing in between) to check when the "bad stuff" is happening exactly? It really loads a huge payload of gallerystuff into s9y, and it cleans up the GET/POST/COOKIE variables once again...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply