Page 1 of 1

Problems using targetpage="" with Gallery module

Posted: Wed Aug 04, 2010 12:39 pm
by krillzip
Environment:
CMSMS 1.7
Gallery module 1.3.2
PHP 5
Runs om Gentoo Linux

What I am trying to do:

I have one page (A) displaying subgalleries:

Code: Select all

...
<div class="wide">
	{Gallery start=1 number=3 targetpage="B"}
</div>
...
Gallery template code

Code: Select all

<ul class="albumlarge selfClear gallery">
{foreach from=$images item=image name=gallery}
	{if $image->isdir}
<li {if $smarty.foreach.gallery.iteration % 3 != 0} style="margin-right: 20px;"{/if}><a href="{$image->file}" title="{$image->titlename}"  rel="lightbox[gallery]"><span class="border"><img src="{$image->thumb}" alt="{$image->titlename}" /></span>{$image->titlename}<span>{$image->comment}</span></a></li>
	{/if}
{/foreach}
</ul>
Clicking on the pictures loads the targetpage (B) but the subgallery doesn't show.

Gallery template code

Code: Select all

<ul class="albumlarge selfClear gallery">
{foreach from=$images item=image name=gallery}
	{if !$image->isdir}
<li {if $smarty.foreach.gallery.iteration % 3 != 0} style="margin-right: 20px;"{/if}><a href="{$image->file}" title="{$image->titlename}"  rel="lightbox[gallery]"><span class="border"><img src="{$image->thumb}" alt="{$image->titlename}" /></span>{$image->titlename}<span>{$image->comment}</span></a></li>
	{/if}
{/foreach}
</ul>
I have tried a number of combinations and solutions on the targetpage (B), having a {content} block, using {Gallery template="page  B"} and no one seems to work.

How should I make the targetpage showing the clicked subgallery?
:-\

Re: Problems using targetpage="" with Gallery module

Posted: Wed Aug 04, 2010 12:54 pm
by Jos
Does the template of page B have at least a normal {content} tag in it? Gallery replaces the {content} tag with its gallerycontent.

Re: Problems using targetpage="" with Gallery module

Posted: Wed Aug 04, 2010 2:13 pm
by krillzip
Have tried with and without. But as you say now there is a {content} field but no images showing up.

Re: Problems using targetpage="" with Gallery module

Posted: Wed Aug 04, 2010 2:30 pm
by krillzip
What I have done:

On all my galleries a manually set the prefered template to a detail page template. So now the pictures show up.

There is however another issue, when I click one gallery on page A there will only be displayed three pictures on page B, because on page A {Gallery number=3} is set.

Is there a way to forget this parameter on the request to page B?

Re: Problems using targetpage="" with Gallery module

Posted: Wed Aug 04, 2010 3:02 pm
by Jos
krillzip wrote: Is there a way to forget this parameter on the request to page B?
You can set the number of images per page in the gallerytemplate you use on page A, in stead of a parameter in the tag. That way the setting wil l not be inherited

[SOLVED] Problems using targetpage="" with Gallery module

Posted: Wed Aug 04, 2010 3:25 pm
by krillzip
Tried it but guess that the gallery still sends the information. The link looks like

.../index.php/gallery/Test 2/1-3-67

where 1-3-67 is variables.

However I solved the problem with a Smarty hack:

Code: Select all

<a href="{$image->file|regex_replace:"/\/1-(\d*)/":"/1-1000"}" ...
the regex setting 1-3-67 to 1-1000-67, which is on those links that does not have the number="" attribute set.

At least it solves the problem for me.

;)

thnx for your time