[SOLVED] Perform action IF parent album's name is XY

andreste

Joined: 2006-06-02
Posts: 123
Posted: Mon, 2006-12-04 22:25

Hi, this is what I'd like to do and I found no threads about it: would it be possible to have a code that says "if the parent album is called XY, then do this"...

Something like this
{if $theme.pageType == 'album'} {g->theme include="album.tpl"} {elseif $theme.pageType == 'photo'} {g->theme include="photo.tpl"} but this time it should look at the parent album's name.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2006-12-05 04:48

{$theme.parent.title|markup} Should get you the title of the parent

Dave

____________________________________________________
Blog with G2 || Gallery Frames / Mods || G1 Test Gallery

 
andreste

Joined: 2006-06-02
Posts: 123
Posted: Mon, 2010-08-30 20:02

Hello, after 4 years I'm back on this matter (I abandoned that idea then, but now I need it again and I still don't know how).

So, should it be something like this?

Quote:
{if $theme.parent.title|markup == 'Male'} blabla1
{elseif $theme.parent.title|markup == 'Female'} blabla2

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2010-08-31 05:27

Should, but I have not tested.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
andreste

Joined: 2006-06-02
Posts: 123
Posted: Tue, 2010-08-31 06:54

Now it works, I had forgotten the space in "else if".
So, if anyone needs it, it's:

{if $theme.parent.title|markup == 'Male'} Male 
{else if $theme.parent.title|markup == 'Female'} Female 
{/if}
 
andreste

Joined: 2006-06-02
Posts: 123
Posted: Mon, 2010-09-06 15:06

Excuse my ignorance, but how do I instruct it to do something else if the title is neither Male nor Female?

For example the root album (and others) shouldn't do anything, but how do I tell Gallery so?

I tried some combinations of IF and ELSE IF and ELSE, but they were really shots in the dark.

thanks
Stefano

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-09-06 15:44
{if $theme.parent.title|markup == 'Male'} Male 
{else if $theme.parent.title|markup == 'Female'} Female 
{else}do something else
{/if}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
andreste

Joined: 2006-06-02
Posts: 123
Posted: Mon, 2010-09-06 16:33

Thank you, that's what I thought and tried, but it doesn't work.

This is what I have:

{if $theme.parent.title|markup == 'Male'} javascript-1 
{else if $theme.parent.title|markup == 'Female'} javascript-2 
{else} zzz
{/if}

but with the final {else} it doesn't work, the page stops loading there. If i remove it, it works (but I get javascript-2 on the root album and other ones).

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-09-06 16:43
 
andreste

Joined: 2006-06-02
Posts: 123
Posted: Mon, 2010-09-06 17:26

thanks Suprsidr, I got it!
If I use the final {else}, I must write {elseif} instead of {else if}.

On the contraty, if I don't use the final {else}, I must write {else if} (or I get nothing!)

thanks a lot