Hi,
I'd like to know if there is a tutorial or something to learn how to create a piwigo extenstion for the 2.0? I searched in the forum and didn't find anything. So is there something to help newbies like me?
thank you
Offline
There are several kinds of extensions : templates, themes, languages, tools and plugins. As the 3 first are quite easy to understand, "tools" can be anything you want, I suppose you're asking about plugins.
As far as I know, the most complete guide is [wiki] Managing Plugins. This link currently goes to the old phpwebgallery.net website, and should be updated soon.
We need some extra documentation about "how to write a plugin" because to tell the truth, a plugin can do quite anything you want :-) Once you will have the whole picture in mind don't hesitate to ask more specific questions, this way we will improve the existing documentation.
Offline
I was looking for some implementations.
E.G.: adding mootools javascript framework and related scripts in some page
I've follow the link to the old documentation and I try the simple element adding for the header
function my_add() { global $template; $url_to_me = get_root_url().'plugins/adam/'; $template->assign_block_vars('head_element', array ( 'CONTENT' => '<link rel="stylesheet" type="text/css" href="'.$url_to_me.'style.css">' )); $template->assign_block_vars('head_element', array ( 'CONTENT' => '<script type="text/javascript" src="'.$url_to_me.'mootools.js"></script>' )); } add_event_handler('loc_end_page_header', 'my_add' );
but result is Call to undefined method Template::assign_block_vars()
I suppose the Template method assign_block_vars is obsolete
where I can find a list of class and methods avalible for the latest version of PWG, and a list of event handlers?
I need in particular how to discriminate a page from another (the category page, the picture page, etc)
Excuse my english, my french is worse
Offline
the template engine has changed, now we use smarty : http://www.smarty.net/docs.php
what you want to do is close to the paMOOramics plugin, you should look inside it ([extension by repie38] paMOOramics)
(for me, it's the way I understood the new template)
Last edited by repie38 (2009-04-25 15:28:21)
Offline
"Template method assign_block_vars is obsolete" that's true.
Piwigo adopted Smarty.
http://www.smarty.net/
You will discover all the documentation you are expecting there.
About the "list of class and methods avalible for the latest version of PWG, and a list of event handlers?"
The event tracer is a developer tool, it is a distributed plugin.
Activate this one.
And have a look on the link after the submit button.
"Click here to see a complete list of actions and events trigered by this PWG version."
"I need in particular how to discriminate a page from another (the category page, the picture page, etc)."
Maybe you should undestood before the template extension logic.
Enjoy.
Latter: Partly duplicate, thanks to repie38
Offline
thanks for the quick reply, now I study the plugin, I know Smarty a little...
Offline
It was very very simple:
<?php if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); class adam { function adam_load ($content) { global $template,$picture,$page; $template->append('head_elements', '<script src="plugins/adam/mootools-1.2.1-core.js" type="text/javascript" charset="utf-8"></script> <script src="plugins/adam/mootools-1.2-more.js" type="text/javascript" charset="utf-8"></script> <script src="plugins/adam/script.js" type="text/javascript" charset="utf-8"></script>'); } } $obj = new adam(); add_event_handler('render_element_content', array(&$obj, 'adam_load'),41,2); ?>
but what's the 3rd and 4th params of add_event_handler? (41,2)
Offline
The third parameter (optional) is the priority... default is 50.
If some plugins use default priority for an handler, and your function must be called before, you must use inferior priority (40, 30, etc...)
If your function need to be called after, you know what to do ;-)
The 4th parameter (optional) is the number of arguments for your function.
If your function need 2 or more arguments, you must fill this parameter.
PS: excuse my english too ;-)
Last edited by P@t (2009-04-25 17:43:29)
Offline
At the beginning I was afraid that no good docs are provided with piwigo, but the forum is powerfull!!!!
Thanks a lot!
My gallery is cooming soon... so I can share with you my knowlege.
I came from Menalto Gallery, but understanding and customizing Piwigo is simpler, and what about the default skin? Is Amazing!
Offline
Don't forget to let a message in introductions and testimonials when your gallery will be ready...
And do not hesitate to ask team if you have another questions ;-)
Offline
The gallery is done.
You can find it at www.lucianoamodio.it/portfolio
Offline
AdamQuadmon wrote:
The gallery is done.
You can find it at www.lucianoamodio.it/portfolio
You should set the default language to italian, it will look even better. Currently, default is french and it looks weird.
Regards.
Offline
mathiasm wrote:
You should set the default language to italian, it will look even better. Currently, default is french and it looks weird.
I think Italian was set as default language, but as $conf['browser_language'] is set to true by default, you mathiasm and I see AdamQuadmon gallery in French.
Offline
That's true! ( by $conf['browser_language'] )
Offline
AdamQuadmon wrote:
The gallery is done.
You can find it at www.lucianoamodio.it/portfolio
From my point of view, it is one of the best example what anyone can do with Piwigo.
Many thanks.
(I will email you in few days).
Offline