Gallery module - link to next page in popup?
Gallery module - link to next page in popup?
Hello there - I just got asked to do something I find odd, but regardless...
I have a site using the Gallery module, with lots of galleries and sub-galleries. I have it set to display only 9 pictures per page, with pagination.
The site's owner would like to have the a link to the next page below the comment on the last photo popup (lightbox, I believe) so that his visitors will know that there are more photos on the next page. (I don't think this is necessary, but I'm trying to be accommodating.) Is this possible? Is there a smarty tag call to make in the template?
I'm not a programmer, so while I can read through code and tinker, I'm not making much sense of the smarty manual. I did see reference to something like "$smarty.something.last" but couldn't figure out how to adapt it. (Here's the link: http://www.smarty.net/manual/en/language.function.foreach.php - search for '.last')
Any help would be greatly appreciated, as always.
I have a site using the Gallery module, with lots of galleries and sub-galleries. I have it set to display only 9 pictures per page, with pagination.
The site's owner would like to have the a link to the next page below the comment on the last photo popup (lightbox, I believe) so that his visitors will know that there are more photos on the next page. (I don't think this is necessary, but I'm trying to be accommodating.) Is this possible? Is there a smarty tag call to make in the template?
I'm not a programmer, so while I can read through code and tinker, I'm not making much sense of the smarty manual. I did see reference to something like "$smarty.something.last" but couldn't figure out how to adapt it. (Here's the link: http://www.smarty.net/manual/en/language.function.foreach.php - search for '.last')
Any help would be greatly appreciated, as always.
Registered Linux User #457788
Re: Gallery module - link to next page in popup?
I think you hit the right smarty spot there, well done 8)
Compare the foreach statement in the module template with the smarty .last example. You'll notice there's a name added, lets say name=foo
Then add some smarty code to the title attribute, for that is what becomes the lightbox caption.
So change this:
to this:
The escape modifier is nescesary because lightbox needs it that way.
Note that it won't work if the last item represents a subgallery
Compare the foreach statement in the module template with the smarty .last example. You'll notice there's a name added, lets say name=foo
Then add some smarty code to the title attribute, for that is what becomes the lightbox caption.
So change this:
Code: Select all
<a href="{$image->file}" title="{$image->title}" rel="lightbox[gallery]">
<img src="{$image->thumb}" alt="{$image->title}" /></a>
Code: Select all
<a href="{$image->file}" title="{$image->title}{if $smarty.foreach.foo.last} {$nextpage|escape:'html'}{/if}"
rel="lightbox[gallery]">
<img src="{$image->thumb}" alt="{$image->title}" /></a>
Note that it won't work if the last item represents a subgallery
Last edited by Jos on Tue Feb 16, 2010 11:40 pm, edited 1 time in total.
Re: Gallery module - link to next page in popup?
So sorry! I got caught up in other projects and didn't see your reply.
Re: smarty manual - Thanks! I know just enough to really muck my code up...
I will try that out tomorrow - thank you. The template he liked best turned out to be a modified version of the Fancybox one though. How much does that change things? Below is my altered code:
Re: smarty manual - Thanks! I know just enough to really muck my code up...
I will try that out tomorrow - thank you. The template he liked best turned out to be a modified version of the Fancybox one though. How much does that change things? Below is my altered code:
Code: Select all
<!-- Fancybox - version 1.2.6 - http://www.fancybox.net/ -->
<div class="gallery">
{if !empty($module_message)}<h4>{$module_message|escape}</h4>{/if}
{if !empty($gallerytitle)}<h3>{$gallerytitle}</h3>{/if}
{if !empty($gallerycomment)}<p><em>{$gallerycomment}</em></p>{/if}
{if $pages > 1}
<div class="prevpage">{$prevpage}</div>
<span class="pagelinks">{$pagelinks}</span>
<div class="nextpage">{$nextpage}</div>
{/if}
{if !$hideparentlink && !empty($parentlink)}<div class="parentlink">{$parentlink}</div>{/if}
<ul class="img-list">
{foreach from=$images item=image}
<li class="img">
{if $image->isdir}
<a href="{$image->file}" title="{$image->title}"><img src="{$image->thumb}" alt="{$image->title}" /></a><br />
{$image->title}
{else}
<a class="group" href="{$image->file}" title="{$image->title} {if !empty($image->comment)}- {$image->comment}{/if}" rel="gallery"><img src="{$image->thumb}" alt="{$image->title}" /></a>
{/if}
</li>
{/foreach}
</ul>
<div class="galleryclear"> </div>
</div>
Registered Linux User #457788
Re: Gallery module - link to next page in popup?
Still no luck for me - I'm confused as to how lightbox and fancybox are different, and I'm not sure what name=foo is/does. Could I trouble you for some clarification? Many thanks!
Registered Linux User #457788
Re: Gallery module - link to next page in popup?
name=foo in the foreach tag is nescesary to be able to use $smarty.foreach.foo.last (which represents TRUE for the last item in the foreach loop)
Lightbox and Fancybox are different indeed. You'll need to go to the fancybox documentation to see how you can add a caption with html. Recently the Fancybox system got updated, so I guess this should be possible now. But I am not able to digg in to it more at the moment.
You can look for "titlePosition" and "titleFormat" in http://fancybox.net/api and http://fancybox.net/blog (tip 7)
Lightbox and Fancybox are different indeed. You'll need to go to the fancybox documentation to see how you can add a caption with html. Recently the Fancybox system got updated, so I guess this should be possible now. But I am not able to digg in to it more at the moment.
You can look for "titlePosition" and "titleFormat" in http://fancybox.net/api and http://fancybox.net/blog (tip 7)
Re: Gallery module - link to next page in popup?
Thanks so much for your help Jos - I really appreciate the time you've put into this. Will play around with this and let you know how it goes!
Registered Linux User #457788
Re: Gallery module - link to next page in popup?
Ok, got part of it figured out. Attached is a screenshot of the result after the following code is applied:
How do I make it a working link? I have no idea where that code really lies...Many, many thanks! (Note: I've had to take this code out until I try it again so my client doesn't see the html code stuff.)
Code: Select all
<!-- Fancybox - version 1.2.6 - http://www.fancybox.net/ -->
<div class="gallery">
{if !empty($module_message)}<h4>{$module_message|escape}</h4>{/if}
{if !empty($gallerytitle)}<h3>{$gallerytitle}</h3>{/if}
{if !empty($gallerycomment)}<p><em>{$gallerycomment}</em></p>{/if}
{if $pages > 1}
<div class="prevpage">{$prevpage}</div>
<span class="pagelinks">{$pagelinks}</span>
<div class="nextpage">{$nextpage}</div>
{/if}
{if !$hideparentlink && !empty($parentlink)}<div class="parentlink">{$parentlink}</div>{/if}
<ul class="img-list">
{foreach from=$images item=image name=foo}
<li class="img">
{if $image->isdir}
<a href="{$image->file}" title="{$image->title}"><img src="{$image->thumb}" alt="{$image->title}" /></a><br />
{$image->title}
{else}
<a class="group" href="{$image->file}" title="{$image->title} {if !empty($image->comment)}- {$image->comment}{/if} {if $smarty.foreach.foo.last} {$nextpage|escape:'html'}{/if}" rel="gallery"><img src="{$image->thumb}" alt="{$image->title}" /></a>
{/if}
</li>
{/foreach}
</ul>
<div class="galleryclear"> </div>
<p>{cms_selflink page='contact-us' text='Contact Us'}</p>
</div>
Last edited by argraff on Wed Mar 17, 2010 9:12 pm, edited 1 time in total.
Registered Linux User #457788
Re: Gallery module - link to next page in popup?
It should work with the code you have now. To try it, I must say I only copied the line
into the original Fancybox template, and added name=foo to the foreach statement.
I sent you a PM with a link to see it work 8)
Code: Select all
<a class="group" href="{$image->file}"
title="{$image->title} {if !empty($image->comment)}- {$image->comment}{/if} {if $smarty.foreach.foo.last} {$nextpage|escape:'htmlall'}{/if}"
rel="gallery">
<img src="{$image->thumb}" alt="{$image->title}" />
</a>I sent you a PM with a link to see it work 8)
Re: Gallery module - link to next page in popup?
Totally weird, I can see it working fine on your site (LOVE Friesians, btw - have two draft mares myself), but I get the same result with the new code. I've compared the source code on both pages - they're exactly the same. I reset Fancy to its default template, added the code, same result. Every way I do it I get
on the last image. (Actually with Fancybox it shows up on every image.)
Is there another setting somewhere that I need to change?
I left the code in the page this time so that you can see it live.
http://northoftheridge.com/gallery/insects/Dragonflies/1-12-56
Many thanks for the continued help! I really appreciate it, Jos.
Code: Select all
<a href="http://blahblahblah">next</a>Is there another setting somewhere that I need to change?
I left the code in the page this time so that you can see it live.
http://northoftheridge.com/gallery/insects/Dragonflies/1-12-56
Many thanks for the continued help! I really appreciate it, Jos.
Registered Linux User #457788



