Right now, i'm getting no comments at all to show... so i am going backwards :p
Jos wrote:Have you tried <pre>{$images|print_r}</pre> ?
Code: Select all
Array
(
[0] => stdClass Object
(
[fileid] => 21
[file] => http://renaultpaarl.modh.co.za/gallery/used_vehicles/Clio-2010/15
[filedate] => 2014-08-04 11:38:02
[filename] => Clio-2010
[title] => Clio 2010
[titlename] => Clio 2010
[comment] => Renault Clio 2010 perfect condition
[fileorder] => 0
[active] => 1
[isdir] => 1
[galleryid] => 2
[gallery_url] => http://renaultpaarl.modh.co.za/gallery/used_vehicles/15
[thumb] => uploads/images/GalleryThumbs/25-6.jpg
[fields] => Array
(
)
)
[1] => stdClass Object
(
[fileid] => 26
[file] => http://renaultpaarl.modh.co.za/gallery/used_vehicles/Twingo-2011/15
[filedate] => 2014-08-04 11:48:45
[filename] => Twingo-2011
[title] => Twingo 2011
[titlename] => Twingo 2011
[comment] => test
[fileorder] => 0
[active] => 1
[isdir] => 1
[galleryid] => 2
[gallery_url] => http://renaultpaarl.modh.co.za/gallery/used_vehicles/15
[thumb] => uploads/images/GalleryThumbs/35-6.jpg
[fields] => Array
(
)
)
)
1
But replacing {$gallerycomment} with {$image->comment} still gives me blank results.
Logically, I am looking to achieve $image->gallerycomment
EDIT: It would seem the issue is not at all related to the core Gallery module, but rather to prettyPhoto.
Using
Code: Select all
{$image->comment} instead of {gallerycomment}
is definitely correct.
Replacing:
Code: Select all
{$image->titlename} ...</div>
with:
gave correct result. It only gets lost inside the prettyPhoto popup.
GOT IT!
1.) Every div that i want to display with prettyPhoto needs to have a unique ID - that's why i was getting wrong comment.
2.) The ID of the div cannot have spaces in it so use smarty replace command to replace spaces with udnerscores.
3.) Use $image->comment. If the $image is a directory, then it is the same as calling $gallerycomment when looking at $images inside that gallery.
Template code:
Code: Select all
<div class="gallery pure-g-r">
<div class="pagenavigation pure-u-1-1 galleryclear">
{if $pages > 1}
<div class="prevpage">{$prevpage}</div>
<div class="nextpage">{$nextpage}</div>
{/if}
{if !$hideparentlink && !empty($parentlink)}<div class="parentlink">{$parentlink}</div>{/if}
{if $gallerytitle ne "Pre-Owned Vehicles"}<pre id="gallerycomment">{$gallerycomment}</pre>{/if}
{if $pages > 1}<div class="pagelinks">{$pagelinks}</div>{/if}
</div>
<pre style="letter-spacing: normal; display: none">{$images|print_r}</pre>
<div class="pure-u-1-1">
{foreach from=$images item=image}
<div class="img">
{if $image->isdir}
<a href="{$image->file}" title="{$image->file}"><img src="{$image->thumb|escape:'url'|replace:'%2F':'/'}" alt="{$image->titlename }" /></a><br />
{$image->titlename} <a href="#{$image->titlename|replace:' ':'_'}" rel="prettyPhoto"><img src="uploads/images/details.jpg" alt="Details" title="Click for details" height="15px" /></a><div id="{$image->titlename|replace:' ':'_'}" class="hidden">{$image->comment}</div>
{else}
<a class="group" href="{$image->file|escape:'url'|replace:'%2F':'/'}" title="{$image->comment}" rel="prettyPhoto[{$galleryid}]"><img src="{$image->thumb|escape:'url'|replace:'%2F':'/'}" alt="{$image->titlename}" /></a>
{/if}
</div>
{/foreach}
</div>
<div class="galleryclear"> </div>
</div>