Proper use of the if issit

HappyMini

Joined: 2011-05-21
Posts: 6
Posted: Sat, 2011-05-21 15:41

Hi everybody,

Just testing G2 and I came across a problem. I'm trying to customize the Siriux theme and I want some things to change when you view a photo, e.g. another background color and hiding the menu.

So, I'd like to know how the 'if issit' works. A solution for my problem is to include another stylesheet on the photo page. Something like this:

Quote:
{if $theme.pageType == 'photo'}
{show /style1.css and hide /style.css"}
{/if}

and the menu one:

Quote:
{if $theme.pageType == 'photo'}
{hide div named menu"}
{/if}

The difference between those two examples is that the first one is a change to something in the <head> of the page and the second one could maybe be added in photo.tpl.

I'm stuck, thank you for help in advance!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2011-05-21 16:51

An esier solution may be to embed your gallery into your site.
I have many tools and examples here.

But to answer your question...
both would likely go into theme.tpl as the <head /> is there ;) and the menu is likely used across other gallery pageTypes and would be part of the main page structure.

{if $theme.pageType == 'photo'}
<link rel="stylesheet" type="text/css" href="/style.css">
{else}
<link rel="stylesheet" type="text/css" href="/otherstyle.css">
{/if}

and using the != (not equal)

{if $theme.pageType != 'photo'}
<ul id="menu">
  <li>menu item</li>
  <li>menu item</li>
  <li>menu item</li>
  <li>menu item</li>
</ul>
{/if}

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

 
HappyMini

Joined: 2011-05-21
Posts: 6
Posted: Sat, 2011-05-21 19:02

Thank you, I get the point of the 'if' code. Going to have a look at the embedding too.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2011-05-23 13:12

or something like

{if $theme.pageType == 'photo'}
<style type="text/css">
    **css to set div to hidden here **
</style>
{/if}
 
HappyMini

Joined: 2011-05-21
Posts: 6
Posted: Sun, 2011-05-29 08:12

Great support guys, thanks.

I got another question, is it possible to show an 'absolute' link to the original album of a photo when shown in a tagged album? A tagged album shows only the 'relative' link to the tagged album itself.

Maybe it's also possible with this if structures?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sun, 2011-05-29 13:23

Isn't there a setting in the admin page for the tags module that says something like "show items in original albums"?

Otherwise, I'm not quite sure what you mean - perhaps some examples would be helpful.

 
HappyMini

Joined: 2011-05-21
Posts: 6
Posted: Wed, 2011-06-01 12:00

No, there isn't a setting available. Well, I can explain:

We want to view photos with the tag nature, so we go to example.com/tag/nature. We click a photo and the breadcrump on that page shows Home / Results with tag: Nature/tree.jpg

Note that tree.jpg is originally in the album 'Trees' (that's what I call the 'absolute' location for this photo). So when someone views this photo in a tagged album, he/she doesn't get a chance to go to the original album. That's because there's only the link back to the tagged album (what I call the 'relative' album, because it's not the album to which tree.jpg originally belongs).

Hope you get my point. When a photo is shown in a tagged album, how to present a link back to the 'original' album that photo belongs to.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2011-06-01 12:25

There is definitely a setting somewhere for "display in original album", because I spent some time trying to get it to function correctly in various dynamic-album modules I wrote. I'll keep investigating until I find it.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2011-06-01 19:41

Found it. It's a theme setting, so may not be available in your theme. Look for "thumbnail links in dynamic albums" and set it to "jump to original album".

If it doesn't exist in your theme then you'll have to do some modifications. Switch to Matrix theme to examine how it works.

 
HappyMini

Joined: 2011-05-21
Posts: 6
Posted: Sun, 2011-06-05 07:30

I got it, thanks. It wasn't available in my theme, I'm going to fix that.