Is there any way to display the description under the image in a slide show in the "stripped" theme?
Thanks, Geoff
Offline
I think not, for the moment.
I don't know why... I'll look.
Offline
My solution to this was to change
<span class="thumbCaption">{if isset($thumbnail.NAME)}{$thumbnail.NAME}{/if}</span>
to
<span class="thumbCaption">{if isset($thumbnail.DESCRIPTION)}{$thumbnail.DESCRIPTION}{/if}</span>
in themes\stripped\template\thumbnails.tpl
It would be much nicer to have this configurable, but for now this works.
-- Geoff
[Note, this is actually wrong. This is the code that I modified to place the description under the thumbnail instead of the file name (which I don't consider very interesting to the viewer).
Last edited by geoffschultz (2012-07-22 21:15:52)
Offline
Hello geoffschultz
since you're understanding how themes works, I introduce you the prefilterers : the goal is to modify the code smarty before its interpretation by smarty
here an example http://piwigo.org/dev/browser/extension … nf.inc.php
You can use prefilters in a plugin (locafiles editor, personal plugin)
/** thumbnails.tpl **/ add_event_handler('loc_end_index_thumbnails', 'MY_thumbnails'); function MY_thumbnails($tpl_thumbnails_var) { global $template; $template->set_prefilter('index_thumbnails', 'MY_prefilter_thumbnails'); } function MY_prefilter_thumbnails($content, &$smarty) { /* here you can manipulate the Smarty/html code by doing replacement, concatenation etc*/ $search = 'thumbnail.NAME'; $replacement = 'thumbnail.DESCRIPTION'; return str_replace($search, $replacement, $content); }
Offline
prefilters avoid any loss by upgrading extensions or piwigo
Offline
Hello flop25,
Thanks for the tutorial! I'll try it!
-- Geoff
Last edited by geoffschultz (2012-07-22 21:55:36)
Offline
I'm a bit confused by this. How is that my modification code won't get replaced if the theme is upgraded? Won't my changes get over-written? Or is the concept to re-insert the modification code after an upgrade?
-- Geoff
Offline
As I said, what I propose is a plugin, a custom one, so it will never be overwritten! And the modification it does are dynamic, in real time ; it doesn't change the tpl file, it change the code smarty reads and just before the interpretation
Offline
Ah, I see! Sorry for being a bit slow...
Thanks, Geoff
Offline
In fact there is a bug in slideshow.tpl.
The definition of the variable "$showtitle" is not correct.
It should be:
{assign var='showTitle' value=false} {if isset($COMMENT_IMG) and $stripped.imageCaption == 'description'} {assign var='showTitle' value=true} {/if} {if isset($current.TITLE) and $stripped.imageCaption == 'title'} {assign var='showTitle' value=true} {/if}
Like in picture.tpl
I'll publish a new version correcting this.
Offline
geoffschultz wrote:
[Note, this is actually wrong. This is the code that I modified to place the description under the thumbnail instead of the file name (which I don't consider very interesting to the viewer).
This is a totally different question (you should make another topic for this, as it is actually a good idea which can be included in a future version - I'm talking about stripped, not piwigo)
Last edited by Zaphod (2012-07-22 23:28:37)
Offline
For the slideshow page, the bug is corrected in version 2.2.6
Offline
Hi Flop!
Coming back to this old topic, I am trying to do the same, but adding your code to the personal plugin and acticating it, makes *all* thumbnails disappear.
Have there been some changes in the stripped theme so that the code below does not work anymore?
I am also working on an extension to the GThumb plugin that allows showing the description instead of the title.
flop25 wrote:
You can use prefilters in a plugin (locafiles editor, personal plugin)
Code:
/** thumbnails.tpl **/ add_event_handler('loc_end_index_thumbnails', 'MY_thumbnails'); function MY_thumbnails($tpl_thumbnails_var) { global $template; $template->set_prefilter('index_thumbnails', 'MY_prefilter_thumbnails'); } function MY_prefilter_thumbnails($content, &$smarty) { /* here you can manipulate the Smarty/html code by doing replacement, concatenation etc*/ $search = 'thumbnail.NAME'; $replacement = 'thumbnail.DESCRIPTION'; return str_replace($search, $replacement, $content); }
Thanks for any suggestion
Norbert
Offline
norbusan wrote:
Hi Flop!
Coming back to this old topic, I am trying to do the same, but adding your code to the personal plugin and acticating it, makes *all* thumbnails disappear.
Have there been some changes in the stripped theme so that the code below does not work anymore?
I am also working on an extension to the GThumb plugin that allows showing the description instead of the title.
Thanks for any suggestion
Norbert
that should still work ; do you have html tags inside your description Could I have a link?
Offline
Hi Flop,
thanks for your answer
flop25 wrote:
that should still work ; do you have html tags inside your description Could I have a link?
hmm, but it didn't. I don't have a link, though. The problem was that the generated html code did not contain *any* reference to photos/thumbnails. The whole thumbnail section was empty. I checked the html code of the generated page. As this was not what I enjoy having on my photo page, I reverted.
I might try to setup an additional site to show the effect, but as I am in teaching semester I am a bit busy with these kinds of things.
Norbert
Offline