[FM Discuss] php challenge... Plugins

adam adam at xs4all.nl
Sat May 15 02:00:17 PDT 2010


hey Luka,

Thanks for this :) I checked out the Wordpress plugin api page:
http://codex.wordpress.org/Plugin_API

I think I will follow this. However it describes how a plugin works, but
im not sure the best way to create a simple structure for creating
hooks...


dont 'spose u (or anyone) have a 10 line php script that can show me how
a hook works?

adam




On Fri, 2010-05-14 at 18:47 +0200, Luka Frelih wrote:
> hello!
> 
> > so instead of building this into Booki/Objavi it might be more
> > appropriate to build this into the publishing script I'm working on
> > now...this would mean that when you install the script on a server and
> > fetch a book you could decide to also include a comment feature, anchors
> > etc......these features would be added at publish (fetch) time and added
> > to the fetched static content on your server.
> >
> > So...I want to add these features as plugins and design a simple method
> > for creating new plugins to extend the functionality of books...i dont
> > know what else could be added but there must be many many other ideas..
> >
> > so...is there anyone out there that could help me design the basic
> > architecture for the plugins? i really dont know the best way to do it
> > and would appreciate any help/advice...
> >
> >
> > adam
> >
> >    
> 
> seems the most common architecture for php plugins is based around 
> registering and hooks.
> 
> to load a plugin, you basically include its main php file. this loads 
> all the code definitions - funcs, classes and runs any code outside any 
> functions. this code can register hooks that plugin needs with the main 
> code.
> 
> hooks are call-back points, preset in the main code, where you find the 
> need for plugins to change something.
> the main code calls into the registered plugins, giving them information 
> and/or acces to its state and something different happens.
> 
> depending on the plugins needs and how the main program works, these 
> will be in different places with different information passed. you 
> should anticipate this to a point, so you can think about how it would 
> be practical to implement obvious extensions (comments,...) but new 
> hooks can be added later too as the need arises. i guess having a good 
> idea how plugins and templates relate helps too.
> 
> this is the runtime, then you need a system to register/load/discover 
> the plugins themselves. better systems also handle discovery, 
> installation and updates of plugins ;)
> 
> you could try to read up on how to make plugins for drupal or 
> mediawiki... get some ideas from there.
> 
> remember, kiss! and much luck...
> 
> best,
> LF
> 
> _______________________________________________
> Discuss mailing list
> Discuss at lists.flossmanuals.net
> http://lists.flossmanuals.net/listinfo.cgi/discuss-flossmanuals.net





More information about the Discuss mailing list