•  » Extensions
  •  » Msg for creators of plugins which add a new index page index.php/xxx

#1 2013-01-31 16:30:57

flop25
Piwigo Team
2006-07-06
7038

Msg for creators of plugins which add a new index page index.php/xxx

hello

A kind of bad habits of coding gas spread among dev, even in the team. So I post this as a reminder and an overview of what's next in 2.5 about that.
This topic is only if your plugin create a new index page index.php/xxx.

1- $page['body_id'] and $page['section'] needs to be defined with custom values by the plugin -only recommended for $page['title']-, using the loc_end_section_init trigger. This is useful for other plugins and themes, in order to declare what type of page is currently running. And for the title -which should be translated-, it's only for SEO.

2- For Piwigo 2.6, a new .tpl file will be added in order to be compatible with template extensions and to easier allow styling for themes. Similar to a stripped index.tpl, it will looks like :

Code:

{$MENUBAR}
{if isset($errors) or isset($infos)}
<div class="content messages{if isset($MENUBAR)} contentWithMenu{/if}">
{include file='infos_errors.tpl'}
</div>
{/if}
{if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}
<div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">
<div class="titrePage">
  <ul class="categoryActions">
{if !empty($PLUGIN_INDEX_ACTIONS)}{$PLUGIN_INDEX_ACTIONS}{/if}
  </ul>
<h2>{$TITLE}</h2>
</div>{* <!-- titrePage --> *}

{if !empty($CONTENT)}
<div class="additional_info">
  {$CONTENT}
</div>
{/if}
{if !empty($PLUGIN_INDEX_CONTENT_END)}{$PLUGIN_INDEX_CONTENT_END}{/if}
</div>{* <!-- content --> *}
{if !empty($PLUGIN_INDEX_CONTENT_AFTER)}{$PLUGIN_INDEX_CONTENT_AFTER}{/if}

where $CONTENT could be any custom .tpl file parsed by the plugin like this :

Code:

  $dir=dirname(__FILE__).'/user_tag.tpl';
  $template->set_filenames(array(
    'user_tag' => realpath($dir),
    )  );
  $template->assign_var_from_handle('CONTENT', 'user_tag');

of course tgis is under development and a wiki article will be written

Thx for reading, if you have any questions, please do on that thread


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

 

#2 2026-03-07 23:41:11

hellen
Member
2026-03-04
4

Re: Msg for creators of plugins which add a new index page index.php/xxx

Hi,

Thanks for sharing this update and the reminder about the coding practices for plugins that create a new index.php/xxx page. Clarifying the use of $page['body_id'] and $page['section'] through loc_end_section_init is really helpful, especially for theme compatibility and for other plugins that may rely on identifying the page context.

I also like the idea of introducing a dedicated .tpl structure for plugin index pages in Piwigo 2.6. Having a cleaner template layout with placeholders like $PLUGIN_INDEX_CONTENT_BEFORE, $PLUGIN_INDEX_ACTIONS, and $CONTENT should make it much easier for theme developers to style plugin pages consistently without needing heavy overrides.

Interestingly, I’ve been experimenting with a small plugin concept inspired by the Letter Boxed puzzle (the word game where players connect letters around a box to form words). If someone were to build a plugin page for displaying a daily puzzle or word challenge inside Piwigo, the structure you described would actually make it much simpler. The puzzle interface or grid could be loaded through a custom .tpl file and assigned to $CONTENT, while still keeping the page compatible with menus, themes, and message blocks.

So the separation you’re proposing between the core layout and the plugin content seems like a really good step for flexibility.

Looking forward to the wiki article and further details once the development progresses. Thanks again for explaining the upcoming changes.

Offline

 
  •  » Extensions
  •  » Msg for creators of plugins which add a new index page index.php/xxx

Board footer

Powered by FluxBB