From: Chris Arnold on
Hello all! I am using Gallery2 which uses the smarty engine. I have a
gallery and a lightbox on this gallery. I have added the class for the
lightbox in the G2 template so the pic's load in a lightbox; like so:
{foreach from=$theme.children item=child}
{if !$child.canContainChildren}
{if $firstItem}
<div class="gallery-items">
{assign var="firstItem" value=false}
{/if}
<div class="gallery-thumb">
<a href="{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}"
class="lightwindow">
{if isset($child.thumbnail)}
{g->image item=$child image=$child.thumbnail}
{else}
{g->text text="no thumbnail"}
{/if}
</a>
</div>
{/if}
{/foreach}

The problem is that the pics load the header and footer in the lightbox.
I have asked this on the G2 forums and the replies were to ask smarty
people. You can see what i am talking about here:
http://www.mytimewithgod.net/wp-gallery2.php?g2_itemId=26
and click on any pic. You will see that the lightbox has the site header
and footer in it. Thanks for any help.
From: "Max Schwanekamp" on
> From: Chris Arnold
>
> Hello all! I am using Gallery2 which uses the smarty engine. I have a
> gallery and a lightbox on this gallery. I have added the class for the
> lightbox in the G2 template so the pic's load in a lightbox; like so:
> [snip]
> The problem is that the pics load the header and footer in the lightbox.
> I have asked this on the G2 forums and the replies were to ask smarty
> people. You can see what i am talking about here:
> http://www.mytimewithgod.net/wp-gallery2.php?g2_itemId=26
> and click on any pic. You will see that the lightbox has the site header
> and footer in it. Thanks for any help.

Seeing as how no one has answered yet, I'll take a stab at it. Maybe
someone more familiar with Gallery2 can give a better answer.

That code below seems to be for the thumbnail listing template. I don't
know much about Gallery2, but it looks like your problem is this line:
<a href="{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}"
class="lightwindow">

The URL resulting from that {g->url...} call is pointing to a full page
rather than just the image. For example, for the first thumb on that page
you get:
<a href="wp-gallery2.php?g2_itemId=27" class="lightwindow"><img ...></a>

Your lightbox script is using that URL to pull the image. If you try that
URL in a browser yourself, you see that you're getting a full page. So
that's what appears in the lightbox. I think you want to be getting the URL
to access the image itself. I just looked at the source on the page at the
above URL, and found the URL to the image itself is:
photos/main.php?g2_view=core.DownloadItem&g2_itemId=27&g2_serialNumber=1

So I guess you'll need to find the template that is used for the individual
photo display page, and either modify your thumbnail listing template or the
lightbox script.

--
Max Schwanekamp
NeptuneWebworks.com
541-517-9064
From: Chris Arnold on
So I guess you'll need to find the template that is used for the individual
photo display page, and either modify your thumbnail listing template or the
lightbox script.

I think i have found that file. Here it is:
{if !empty($theme.imageViews)}
{assign var="image" value=$theme.imageViews[$theme.imageViewsIndex]}
{/if}

<h2>{$theme.item.title|markup}</h2>

{if !empty($theme.imageViews)}
{capture name="fallback"}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"
forceFullUrl=true forceSessionId=true}">
{g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1}
</a>
{/capture}

{if ($image.viewInline)}
<div class="gallery-photo">
{if $theme.params.enableImageMap}{strip}
{if isset($theme.navigator.back)}
<a href="{g->url params=$theme.navigator.back.urlParams}"
id="prevArrow" style="position: absolute; margin: 30px 0 0 30px; visibility: hidden"
onmouseover="document.getElementById('prevArrow').style.visibility='visible'"
onmouseout="document.getElementById('prevArrow').style.visibility='hidden'"
><img src="{g->theme url="images/arrow-left.gif"}" alt="" width="20" height="17"
/></a>{/if}
{g->image item=$theme.item image=$image class="gallery-photo"
fallback=$smarty.capture.fallback usemap=#prevnext}
{if isset($theme.navigator.next)}
<a href="{g->url params=$theme.navigator.next.urlParams}"
id="nextArrow" style="position:absolute; margin: 30px 0 0 -50px; visibility: hidden"
onmouseover="document.getElementById('nextArrow').style.visibility='visible'"
onmouseout="document.getElementById('nextArrow').style.visibility='hidden'"
><img src="{g->theme url="images/arrow-right.gif"}" alt="" width="20" height="17"
/></a>{/if}
{/strip}{else}
{g->image item=$theme.item image=$image class="gallery-photo"
fallback=$smarty.capture.fallback}
{/if}
</div>
{else}
{$smarty.capture.fallback}
{/if}
{else}
{g->text text="There is nothing to view for this item."}
{/if}

{* Navigation image map *}
{if $theme.params.enableImageMap && !empty($image.width) && !empty($image.height)}
<map id="prevnext" name="prevnext">
{if isset($theme.navigator.back)}
<area shape="rect" coords="0,0,{math equation="round(x/2-1)" x=$image.width},{$image.height}"
href="{g->url params=$theme.navigator.back.urlParams}"
alt="{$theme.item.title|markup:strip|default:$theme.item.pathComponent}"
onmouseover="document.getElementById('prevArrow').style.visibility='visible'"
onmouseout="document.getElementById('prevArrow').style.visibility='hidden'"/>
{/if}
{if isset($theme.navigator.next)}
<area shape="rect" coords="{math equation="round(x/2)"
x=$image.width},0,{$image.width},{$image.height}"
href="{g->url params=$theme.navigator.next.urlParams}"
alt="{$theme.item.title|markup:strip|default:$theme.item.pathComponent}"
onmouseover="document.getElementById('nextArrow').style.visibility='visible'"
onmouseout="document.getElementById('nextArrow').style.visibility='hidden'"/>
{/if}
</map>
{/if}


<br style="clear: both;" />


{* Navigator *}
{if !empty($theme.navigator)}
{g->callback type="core.LoadPeers" item=$theme.item windowSize=1}
{g->block type="core.Navigator" navigator=$theme.navigator prefix="&laquo; " suffix=" &raquo;"
currentItem=$block.core.LoadPeers.thisPeerIndex totalItems=$block.core.LoadPeers.peerCount}
{/if}

<hr/>

{* Description *}
{if !empty($theme.item.description) && ($theme.item.description != $theme.item.title)}
<p>{$theme.item.description|markup}</p>
{/if}

{* Download *}
{if !empty($theme.sourceImage) &&

Not sure if i should be looking for <img src> or href tags?
From: "Max Schwanekamp" on
From: Chris Arnold [mailto:carnold(a)electrichendrix.com]
> I think i have found that file. Here it is:

Just to be clear, that template code you pasted in is apparently getting included into the main theme template. The <h2> is the start of the output in the template code you sent, and that doesn't show up until line 218 in the final rendered page. Anyway, looks like the image is coming from this:

{g->image item=$theme.item image=$image class="gallery-photo"
fallback=$smarty.capture.fallback usemap=#prevnext}

This {g->image} tag (which is being passed the "item","class" and other parameters, is apparently a custom plugin specific to Gallery2... Oh, hm, did you read and follow this? I think this describes how to do what you want.
http://codex.gallery2.org/Gallery2:Lightbox_JS_Tutorial

HTH

--
Max Schwanekamp
NeptuneWebworks.com
541-517-9064
From: Chris Arnold on
Max Schwanekamp wrote:
>
> Just to be clear, that template code you pasted in is apparently getting included into the main theme template. The <h2> is the start of the output in the template code you sent, and that doesn't show up until line 218 in the final rendered page. Anyway, looks like the image is coming from this:
>
> {g->image item=$theme.item image=$image class="gallery-photo"
> fallback=$smarty.capture.fallback usemap=#prevnext}
>
So, should i remove some of this link? I have to be honest (as if you
already did not know) this smarty stuff is a little mind bending...

>>This {g->image} tag (which is being passed the "item","class" and other parameters, is apparently a custom plugin >>specific to Gallery2...
So, are you telling me that smarty list can not help and to take it to the g2 forum? If so, g2 forum told me to take it to a different list :(
>>Oh, hm, did you read and follow this? I think this describes how to do what you want.
>>http://codex.gallery2.org/Gallery2:Lightbox_JS_Tutorial
Yeah been all over that and what i am using is not really lightbox; however it is a light"whatever" script. It is called lightwindow (and this dev told me to take it to the g2 forums that it is not a lightwindow issue). Another thing about that codex link, i am using the siriux theme and none of that code that you are asked to change is in the siriux code (oh, i remember now, the them dev told me that g2 was built on smarty engine). As you can see, i have been all over the place trying to get help. By far, this list has helped the most. So thank you for that help. Just unsure how to resolve this.
 | 
Pages: 1
Prev: SmartyPaginate issues...I think