{solved} How do I give a unique BODY ID to each album?

giventofly76

Joined: 2005-01-01
Posts: 23
Posted: Sat, 2007-06-02 02:51

Hello,

I am linking to various albums in the global navigation. Please visit the gallery and click on "Photocards". https://www.finesart.com/gallery/ Notice the tab for "gallery" is "active" and not "Photocards". For usability purposes, I need the correct tab to be "active".

How do I give each gallery a unique BODY ID so I can use this very common navigation effect? If a unique ID isn't possible, is there a php solution?

Thanks!

-Shaun

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2007-06-02 03:59

I have found 2 tools that are invaluable the firefox browser and the web development tool that allows you to Make live edits to the CSS of a web page..
Once you have them both installed....
select edit css and under the 'information' dropdown check display ID & class details.
Edit your CSS and you will see the results. Once you have this the way you want, upload your edited css to the server.

Edit theme.css of the theme you are using: themes/matrix/theme.css

.gbBlock {
    padding: 0.7em;
    border-width: 0 0 1px 0;
    border-style: inherit;
    border-color: inherit;
    /* IE can't inherit these */
    border-style: expression(parentElement.currentStyle.borderStyle);
    border-color: expression(parentElement.currentStyle.borderColor);
    text-align: center;
}

save in a local directory.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
giventofly76

Joined: 2005-01-01
Posts: 23
Posted: Sat, 2007-06-02 19:48

Thanks. The Dev Toolbar is awesome.

The technique I'm trying to achieve is called descendant selector.

There needs to be a Unique BODY ID for each album so I can use the common "active" technique for the navigation tabs. The problem is that the content of each album is generated dynamically within the <body class="gallery">. Since the body class never changes, I can't use this method.

If anyone who is familiar with CSS will recognize exactly what I'm trying to do and why I'm having a problem.

Thanks for your time!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2007-06-03 00:58

I might have posted a bit more to you than you asked for. Or I pasted to the wrong post.
I don't know why I gave you how to center a item in the matrix theme. Anyway......I think I understand now.

You can change the body class if you like. in modules/themes/carbon/templates/theme.tpl find:
<body class="gallery">
There you should be able to change it to the album name. Try something like:
<body class="{$theme.item.title}">

It will take a bit more to get the album title when on the photo page.

Is that what you are after?

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
giventofly76

Joined: 2005-01-01
Posts: 23
Posted: Sun, 2007-06-03 02:10

Yes! Thank you very much.

I am very interested in an easy way to get the album title on the photo page.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2007-06-03 04:09
  {if $theme.pageType == 'album'}{$theme.item.title}{/if}
  {if $theme.pageType == 'photo'}{$theme.parent.title}{/if}

should do the trick.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
giventofly76

Joined: 2005-01-01
Posts: 23
Posted: Sun, 2007-06-03 17:16

Yes, thanks again. That did the trick.

However, that solution leads to another problem. The album names with spaces don't work with the css. Is there some extra php code that can be added to clean up the album name after the space? Example "Photo Cards" becomes "Photo"?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2007-06-03 18:34

{$theme.parent.title|strip:'_'}
will add an underscore where the space is.
or you could try the http://smarty.php.net/manual/en/language.modifier.truncate.php
modifier.

{$theme.parent.title|truncate:5}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
giventofly76

Joined: 2005-01-01
Posts: 23
Posted: Sun, 2007-06-03 22:07

Thank you!

I donate to gallery regularly. I'm going to donate a little extra next time for your great support.