Page 1 of 1

Howto write a plugin?

Posted: Fri Apr 27, 2007 9:54 am
by gotchi
Hi

I googled a little bit, searched on the s9y.org homepage and after all I wasn't able to find out how to code a plugin.
In case of this, it's no wonder why most of the plugins were written by a few people.

So, what I wanna do is write a sidebar plugin, is there a easy way or a good howto who shows me how to creat alle necessary files, what I need for the first steps and what I can do further on.
I cant find something like that, and in comparison to wordpress plugins (I know its bad) creating s9y plugins for sidebar looks more complicated - especially with no step by step howtos.

Ok, is there any easy way, any good howto (not the documentation its for geeks or I couldn't find the right one for normal people knowing php little bit) or whatever. If I manage it, i will create some sidebar plugins ;) and offer my german skills to translate it for the german speaking folks.

thanks

Re: Howto write a plugin?

Posted: Fri Apr 27, 2007 1:48 pm
by garvinhicking
Hi!

What did you search for? :)

I would do it like this:

1. Enter www.s9y.org

2. Go to "Technical Documentation"

3. Go to "Plugins" / "Plugin API".

Pretty straight forward. :-)

I'd be really interested what your steps in searching were. Maybe we can learn from that and announce our documentation differently.

All a sidebar plugin has to do is use PHP code in the "generate_content()" method of the PHP class file. The best thing for a how-to is to take an existing plugin, duplicate it, and hack away at that. With basic PHP skills you should have your own plugin runnin in an hour or so. :-)

Best regards,
Garvin

Posted: Fri Apr 27, 2007 2:59 pm
by gotchi
on my searching tour I found your mentioned docs.
the problem is - how many free time programmers are able to read this sort of documentation.

a lot of stuff described there, events, methods etc. etc.
taking an existing plugin is nice, but in my opinion there should be a howto which describes the basics for developing a plugin from the scratch.
so every newbie in s9y plugin programming can start with it.
after that they will understand the documentation.

perhaps little bit overloaded, but its like learning how to use a java api.
a lot of people know the basic skills of java programming, then they take the documentation of the api and need days to get a result.
that leads to the point, that the most people with good ideas never finish their programs.
if there would be an easy description to use this api with samples and more - everybody tries to write their own stuff.

hopefully you understand - I like programming but to get into something new would take less time with some nice samples and howtos insteed of overloaded and complicated specs.

its not the programmers point of view, its the fun and hobby programmes point of view.

Posted: Fri Apr 27, 2007 3:16 pm
by garvinhicking
Hi!

Ah, you should've mentioned that you found these docs already. :)

All free time programmers I've yet pointed to those docs were able to read and understand the docs. The docs are at a pretty basic level already, IMHO.

But I agree that more documentation can never hurt. I will add anything that the community wants to contribute. Drop me a line and I'll instantly add Wiki-access for anyone who wants to help.

The problem of a how to is, what easy plugin should we describe? S9y already comes with bretty easy plugins, and they all already exist. No "dummy plugin" will ever cover what a person might want to develop in s9y, so why not let that person check out similar existing plugins to modify them to their needs?
a lot of people know the basic skills of java programming, then they take the documentation of the api and need days to get a result.
You can't compare a coding language like java with an API of a programming language.

It seems you are more looking for a PHP how-to on how to use class-based APIs, more general and not really applied to serendipity?

It is beyond the scope of Serendipity to deliver that. There are much better books on API usage and Pattern development that should be read before creating plugins in a language that someone might have trouble with. PHP is a prerequisite for building a s9y plugin. We cannot offer documentation/how tos on how to developer a s9y plugin for people that don't know PHP.

Once you are familiar with APIs, having the API functions/methods in our docs should help anyone further... (I won't deny that more verbose descriptions would be helpful of course).

So exactly for people like you who want more "solid" examples - we have a load of mroe than 150 plugins to look at. They can all be considered as examples - at least 1/3 of the plugins are so small in size that anyone with PHP knowledge will easily see what the plugins do.

There are larger plugins like Staticpage for exaple that no one should have a look at who's not developed plugins on his own yet, of course.

Just throwing my personal $0.02. :-)

Best regards,
Garvin

Posted: Sun Apr 29, 2007 10:38 pm
by gotchi
ok, perhaps you are right
in case of this - I will stick to the docs and existing plugins to build my own one ;)