Announcement

  •  » Engine
  •  » Thoughs about new template-plugin interaction

#16 2014-01-22 14:20:00

flop25
Piwigo Team
2006-07-06
7037

Re: Thoughs about new template-plugin interaction

We can see that you don't make many themes but lots of plugins ^^

there are several cases here:

-plugin wanting to add code which can't be handled by templates and should not be: like user_collection add stuff on thumbnails, like image_preview add attributes too on thumbnails, like_gbo on the main picture...
That kind of technical addition can't be managed in other ways than doing search&replace, and intercompatibility can't be handled automaticly: the best which can be done in that case, is the plugin creators doing their best to handle a max of themes, and theme creator doing their best to be compatible or integrate the code of the plugin, with all the problem which can comes from that, indeed.

-plugin adding content which shouldn't be handled by themplates: especially small addition or stuff which doesn't need to be structurally changed. here a simple {trigger_insert name="loc_begin_stuff"} or {$LOC_BEGIN_STUFF} is enougth

-plugin adding content which can and should be handled by templates: like {if !empty($PLUGIN_INDEX_BUTTONS)}{foreach from=$PLUGIN_INDEX_BUTTONS item=button}<li>$button}</li>{/foreach}{/if} which might not be li but div for another theme
For the index blocs that could be like http://piwigo.org/dev/browser/extension … blocks.tpl which is very standard to add any type of content as a block
Here Wp use functions like the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' );

AND finally
plugin adding content in areas where we can't predict, more content which should be structurally changed but can't be (pop-up, pop-in, areas where we put only {$LOC_BEGIN_STUFF} ...)... and we can't do anything about... maybe fetching before displaying so the theme could re-change the html rendered just before the display

WP has even more problem, because a plugin can't "prefilter" the "template" code so people have to add themself the php code of the plugin, so really our system is good

my conclusion : ok to add more "$PLUGIN_INDEX_BUTTONS" and more {trigger_insert name="loc_begin_stuff"} or {$LOC_BEGIN_STUFF}, and you will never get rid of prefilters and change the problematic.


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#17 2014-01-23 12:43:35

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: Thoughs about new template-plugin interaction

So we agree :)

is the plugin creators doing their best to handle a max of themes, and theme creator doing their best to be compatible or integrate the code of the plugin, with all the problem which can comes from that, indeed.

That's what I did recently with User Collections by cleaning "variables namespace", I even added a readme http://piwigo.org/dev/browser/extension … README.txt

actually many parts of user Collections could be handled with "trigger_insert" (if well thinked)

--

maybe fetching before displaying so the theme could re-change the html rendered just before the display

"fetching" ?
don't forget that themes can also declare prefilters, so one can decide to add a prefilter to "comments_on_albums"

--

syntactically we could add these template methods :

- get_blocks('index_buttons') used in a foreach

Code:

{foreach from=get_blocks('index_buttons') item=block}

- get_content('end_picture_info') (better that 'trigger_insert' I think)
I don't know if Smarty allow this syntax:

Code:

{get_content('end_picture_info')}

if not, keep:

Code:

{get_content name='end_picture_info'}

(I prefer the first form because coherent with get_blocks)

and these PHP methods :
- Template::add_block()
- Template::add_content()

In a very flexible way : raw content, or path to a template file or callback function


and we ask to developers to use preferentially add_block, then add_content, and finally prefilters if it can't be achieved otherwise

Offline

 

#18 2014-01-23 13:44:20

flop25
Piwigo Team
2006-07-06
7037

Re: Thoughs about new template-plugin interaction

Sounds very good

about fetching http://www.smarty.net/docs/en/api.fetch.tpl,  it's more about a plugin adding a whole html complexe code using get_content or a  {$LOC_BEGIN_STUFF}: does the theme has a oportunity to get the code, because the theme is sending a string?


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 
  •  » Engine
  •  » Thoughs about new template-plugin interaction

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact