testing if child is linkitem: how?

alecmyers

Joined: 2006-08-01
Posts: 1491
Posted: Tue, 2007-01-09 14:08

I'd like to modify Siriux so that linkitems are displayed with albums rather than with (childless) images.

I plan to do this by modifying the album.tpl file so that this:

{if $child.canContainChildren }

becomes

{if $child.canContainChildren || [child is a linkitem] }

what do I need to test to see if the child is a link?

I should add (if it isn't obvious) that I'm a total novice to Smarty, although have programming experience.

Thanks for any help.

Login or register to post comments
talmdal

Joined: 2006-12-06
Posts: 119
Posted: Tue, 2007-01-09 14:57

I'm still fairly new as well so there might be a better way, but you could try

child.entityType == 'GalleryLinkItem'

Login or register to post comments
alecmyers

Joined: 2006-08-01
Posts: 1491
Posted: Tue, 2007-01-09 15:18

Brilliant, thanks -

{if $child.canContainChildren}

becomes
{if $child.canContainChildren || $child.entityType == 'GalleryLinkItem'}

and
{if !$child.canContainChildren }

becomes
{if (!$child.canContainChildren) && $child.entityType != 'GalleryLinkItem' }

which works perfectly.

Login or register to post comments
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Mon, 2007-01-15 21:37

I would like the linked items to be displayed as albums as well and not just the image. I am using matrix theme.
Here i have the example:
http://www.ffaabbiiaann.de/index.php?option=com_gallery2&Itemid=56&g2_itemId=7140

would your solution make the link look like the other albums? or did i get this wrong?

Fabs

_____________________________________________________
Breath in love...--------------
------------...breath out peace

Please visit my private website and the embeded gallery: http://www.ffaabbiiaann.de

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 11215
Posted: Tue, 2007-01-16 05:58

fabs Yes:
http://langleycom.com/g2/main.php Don't know if it works with lightbox or not, give it a go.

talmdal Thanks!
_____________________________________________
Blog & G2 || floridave @ Gallery Team || G2 Theme Contest: +$3k in Prizes!

Login or register to post comments
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Tue, 2007-01-16 06:20

Ok- so i replace ALL(?) instances of {if $child.canContainChildren} in album.tpl with {if $child.canContainChildren || [child is a linkitem] } and all {if !$child.canContainChildren } with {if (!$child.canContainChildren) && $child.entityType != 'GalleryLinkItem' }

Fabs

_____________________________________________________
Breath in love...--------------
------------...breath out peace

Please visit my private website and the embeded gallery: http://www.ffaabbiiaann.de

Login or register to post comments
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Wed, 2007-01-17 04:04

forget about the following problems ! i got it all working now! seemed to be due to resistant data because i had gallery in full acceleration mode. although i always cleared the caches some things seemed to interfere still. now working! Thanks sooo much!

Quote:
1)
replacing all instances gives me this error when trying to go to the album:

Fatal error: Smarty error: [in gallery:themes/matrix/templates/album.tpl line 83]: syntax error: unidentified token '[child' (Smarty_Compiler.class.php, line 1391) in /www/gallery/lib/smarty/Smarty.class.php on line 1088

2)
For some reason on my linked albums the item name appears. normally just the title should appear... i need to get rid of the linked item name.
see the linked item here:
http://www.ffaabbiiaann.de/gallery/main.php?g2_itemId=7140

Fabs

_____________________________________________________
Breath in love...--------------
------------...breath out peace

Please visit my private website and the embeded gallery: http://www.ffaabbiiaann.de

Login or register to post comments
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Tue, 2007-01-23 14:39

What statement do i have to add to also exclude movies?
So far i have this:
{if $child.canContainChildren || $child.entityType == 'GalleryLinkItem'}

The problem is that lightbox hack opens movies in lightbox but cannot play them. so i also need to exclude all movie file types.

thx for support

Fabs

_____________________________________________________
Breath in love...--------------
------------...breath out peace

Please visit my private website and the embeded gallery: http://www.ffaabbiiaann.de

Login or register to post comments
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Tue, 2007-01-23 15:26

half solved:

i put:
{if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem' || $child.entityType == 'GalleryMovieItem')}
and it works

but using lightbox for my images i would much rather have the movies open in a popup as well.

any workaround for that?

thx
fabs
_____________________________________________________
Breath in love...--------------
------------...breath out peace

Please visit my private website and the embeded gallery: http://www.ffaabbiiaann.de

Login or register to post comments
kreneskyp

Joined: 2007-04-10
Posts: 1
Posted: Tue, 2007-04-10 21:49
Quote:
but using lightbox for my images i would much rather have the movies open in a popup as well.

I second that. I've been looking into making this possible. I've gotten it mostly functional but theres a few problems.

Lightbox works by looking for the "rel" property and then updates the anchor object. An onclick event handler is added to the link. This is where the problem is. The event handler only receives the url for the image. It doesn't get things like "object type", "height" or "width". Complicating matters more, Lightbox is only setup to dynamically update an image tag.

So here is what i did:

1) update album.tpl to use rel="lightbox[photos]" or rel="lightbox[movies]" based on item type.
2) update lightbox.js to dynamically create either an image tag or an activeX movie player based on the value of rel

Heres my problems:

1) I can't tell what size the video is so i cant set the size of the player. I can set it to an arbitrary size and hope you have smaller video but thats not a great solution.
2) prev and next buttons only cycle through objects of the same type, preferably i should get both types.

At the moment it seems that the only way to get the video size is from gallery2's database and pass it in along with the URL. This would require rewriting a bit more of lightbox's code and figuring out how to get that information out of gallery2

Login or register to post comments
gipolt

Joined: 2007-06-25
Posts: 2
Posted: Mon, 2007-06-25 01:41
kreneskyp wrote:
Quote:
but using lightbox for my images i would much rather have the movies open in a popup as well.

I second that. I've been looking into making this possible. I've gotten it mostly functional but theres a few problems.

Lightbox works by looking for the "rel" property and then updates the anchor object. An onclick event handler is added to the link. This is where the problem is. The event handler only receives the url for the image. It doesn't get things like "object type", "height" or "width". Complicating matters more, Lightbox is only setup to dynamically update an image tag.

So here is what i did:

1) update album.tpl to use rel="lightbox[photos]" or rel="lightbox[movies]" based on item type.
2) update lightbox.js to dynamically create either an image tag or an activeX movie player based on the value of rel

Heres my problems:

1) I can't tell what size the video is so i cant set the size of the player. I can set it to an arbitrary size and hope you have smaller video but thats not a great solution.
2) prev and next buttons only cialisis through objects of the same type, preferably i should get both types.

At the moment it seems that the only way to get the video size is from gallery2's database and pass it in along with the URL. This would require rewriting a bit more of lightbox's code and figuring out how to get that information out of gallery2

tnx for it. ;)

Login or register to post comments
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Mon, 2007-06-25 11:44
kreneskyp wrote:
Quote:
but using lightbox for my images i would much rather have the movies open in a popup as well.

I second that. I've been looking into making this possible. I've gotten it mostly functional but theres a few problems.

Lightbox works by looking for the "rel" property and then updates the anchor object. An onclick event handler is added to the link. This is where the problem is. The event handler only receives the url for the image. It doesn't get things like "object type", "height" or "width". Complicating matters more, Lightbox is only setup to dynamically update an image tag.

So here is what i did:

1) update album.tpl to use rel="lightbox[photos]" or rel="lightbox[movies]" based on item type.
2) update lightbox.js to dynamically create either an image tag or an activeX movie player based on the value of rel

Heres my problems:

1) I can't tell what size the video is so i cant set the size of the player. I can set it to an arbitrary size and hope you have smaller video but thats not a great solution.
2) prev and next buttons only cycle through objects of the same type, preferably i should get both types.

At the moment it seems that the only way to get the video size is from gallery2's database and pass it in along with the URL. This would require rewriting a bit more of lightbox's code and figuring out how to get that information out of gallery2

thx but would it be possible to get a more step by step explaination. and how about the size problems.. any news on that?
thanks
Fabs

_____________________________________________________
Breath in love...--------------
------------...breath out peace

Please visit my private website and the embeded gallery: http://www.ffaabbiiaann.de

Login or register to post comments