Announcement

#1 2012-07-20 22:38:10

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
148

[resolved] Stripped Slideshow Description Under Image

Is there any way to display the description under the image in a slide show in the "stripped" theme?

Thanks, Geoff

Offline

 

#2 2012-07-20 22:48:08

Zaphod
Piwigo Team
2006-11-13
441

Re: [resolved] Stripped Slideshow Description Under Image

I think not, for the moment.
I don't know why... I'll look.

Offline

 

#3 2012-07-22 16:34:02

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
148

Re: [resolved] Stripped Slideshow Description Under Image

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

 

#4 2012-07-22 18:16:30

flop25
Piwigo Team
2006-07-06
6965

Re: [resolved] Stripped Slideshow Description Under Image

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)

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);
}

more:
http://www.php.net/manual/en/function.str-replace.php


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

 

#5 2012-07-22 18:20:35

flop25
Piwigo Team
2006-07-06
6965

Re: [resolved] Stripped Slideshow Description Under Image

prefilters avoid any loss by upgrading extensions or piwigo


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

 

#6 2012-07-22 21:18:15

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
148

Re: [resolved] Stripped Slideshow Description Under Image

Hello flop25,

Thanks for the tutorial!  I'll try it!

-- Geoff

Last edited by geoffschultz (2012-07-22 21:55:36)

Offline

 

#7 2012-07-22 21:54:53

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
148

Re: [resolved] Stripped Slideshow Description Under Image

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

 

#8 2012-07-22 22:10:37

flop25
Piwigo Team
2006-07-06
6965

Re: [resolved] Stripped Slideshow Description Under Image

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


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

 

#9 2012-07-22 22:23:18

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
148

Re: [resolved] Stripped Slideshow Description Under Image

Ah, I see! Sorry for being a bit slow...

Thanks, Geoff

Offline

 

#10 2012-07-22 23:23:35

Zaphod
Piwigo Team
2006-11-13
441

Re: [resolved] Stripped Slideshow Description Under Image

In fact there is a bug in slideshow.tpl.

The definition of the variable "$showtitle" is not correct.
It should be:

Code:

  {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

 

#11 2012-07-22 23:25:16

Zaphod
Piwigo Team
2006-11-13
441

Re: [resolved] Stripped Slideshow Description Under Image

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

 

#12 2012-07-22 23:32:00

Zaphod
Piwigo Team
2006-11-13
441

Re: [resolved] Stripped Slideshow Description Under Image

For the slideshow page, the bug is corrected in version 2.2.6

Offline

 

#13 2014-10-21 08:15:30

norbusan
Member
Nonoichi, Ishikawa, Japan
2011-06-11
60

Re: [resolved] Stripped Slideshow Description Under Image

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

 

#14 2014-10-21 09:45:42

flop25
Piwigo Team
2006-07-06
6965

Re: [resolved] Stripped Slideshow Description Under Image

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?


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

 

#15 2014-10-21 15:50:19

norbusan
Member
Nonoichi, Ishikawa, Japan
2011-06-11
60

Re: [resolved] Stripped Slideshow Description Under Image

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

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact