G2 Templating - Passing in $params keys Issue

paulsri

Joined: 2005-03-23
Posts: 2
Posted: Wed, 2005-03-23 19:14

Hi All,

I'm trying to add support for onmouseover and onmouseout to the thumbnails as follows in layouts/squares/templates/albumBody.tpl:

{g->image item=$child image=$child.thumbnail class="img-thumbnail-overlay" onmouseover="thumbnail_show(this);" onmouseout="thumbnail_hide(this);"}

It seems that in: modules/core/classes/GalleryDerivativeImage.class only the 'class' attribute is supported even though I have modified the 'return' statement to include:

<snip>
return sprintf('<img%s%s%s src="%s"%s%s%s%s alt="%s" longdesc="%s"/>', $params['class'] ? ' class="' . $params['class'] . '"' : '',
$params['onmouseover'] ? ' onmouseover="' . $params['onmouseover'] . '"' : '',
$params['onmouseout'] ? ' onmouseout="' . $params['onmouseout'] . '"' : '',
$src,
$sizeStr,
$nameStr,
</snip>

I'm using gallery2 beta 1, BTW.

Thanks in advance!

Paul

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-03-23 20:10

ya, it would be nice if it would pass-through anything you give to {g->image}.. maybe someone can work on that..
for now, you'll also need to edit function image() in modules/core/classes/GalleryTemplateAdapter to pass those params along..
(if you make a patch to pass along whatever, that would be great :))

 
paulsri

Joined: 2005-03-23
Posts: 2
Posted: Thu, 2005-03-24 17:57

Thanks mindless! I'll give this a try and let you know what happens.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-04-14 20:52

hm, didn't hear back... but today I wanted to add style=".." so I went ahead and made the change.. {g->image} doesn't pick out specific attributes anymore.. item, image, maxSize and fallback have special meaning but anything else is passed through and rendered as attributes of the <img> tag.