Page 1 of 1

plugin confuses s9y

Posted: Thu Sep 30, 2004 3:45 pm
by romulus

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: ... yembed.txt
init.php (init file of gallery that gets called by random-block):

Re: plugin confuses s9y

Posted: Wed Oct 06, 2004 12:05 pm
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 :-)

Posted: Wed Oct 06, 2004 12:13 pm
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: ... yembed.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?

Posted: Wed Oct 06, 2004 12:19 pm
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...