Plugin: Phpbox.

Creating and modifying plugins.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

You can try to use "?><?php" at the beginning, I think that is propper.

Apart frmo this, your code does not evaluate here in my eval() tests at well. It is not suitable for a code to be executed in a PHP Box environment. It is very much suggested that you make a plugin out of this. Also your code would not run because it tries to include wrong files and creates a new DB connection which would kill the s9y db connection. Check the changes I have made below.

This is very easy using the template "serendipity_plugin_gallery_menalto_random": http://nopaste.php-q.net/140741

Regards,
Garvin
# 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/
JulianDE
Regular
Posts: 13
Joined: Sat May 28, 2005 9:44 pm
Location: Germany

Post by JulianDE »

Thank you Garvin,

I've pasted the code into a new and empty plugin file but calling it from plugin installer menu is not possible:
Fehler: serendipity_plugin_recent_posts

Do I have to adapt something in the code?
When reffering to a path - which is the relative position the plugin is referring from? the root?

I thought if the file runs on its own and display the 5 recent topics there is a chance to simply have the output in the sidebar, but I guess this is not as easy as I expected.

thanks a lot,
Julian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Julian, sadly that code was not crafted to be included in a page with other content. If the file just fails, try if it contains parse errors. "php -l" with the binary can check that, or any decent PHP Editor...

Regards,
Garvin
# 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/
JulianDE
Regular
Posts: 13
Joined: Sat May 28, 2005 9:44 pm
Location: Germany

Post by JulianDE »

didn't want to accept it as there are several sites around with recent topics integrated in some kind of php blog software. I've tried 'include' and it works now! :-)

I guess I just was too stupid and you guys already assumed I had used 'include'. So I understand the code doesn't work when pasted into the php box plugin in the editor but does work when called with include :-)

thanks a lot Garvin,

yours happy Julian :-)
deiszner
Regular
Posts: 43
Joined: Fri Oct 12, 2007 1:06 am
Location: Leipzig
Contact:

Post by deiszner »

you should say to the users of your fantastic (really fantastic) plugin, that they are not allowed to use the wysiwyg editor for editing the "inserted php code" - i needed 2 hours to recognize this fact !

but the plugin is very good :D :D :D :D
Post Reply