css class on body depenging on album

Hi. I'd like to find a way to add a css class (or id) to the body element, depending on the main parent album that I'm in. So that I can create special styles only for certain albums. For example: <body class="parent-album-id-7">. Does anyone know how to do this ?

Comments

  • acrylian Administrator, Developer
  • So how exactly should I use it ? I have tried these:
    <body class="top_album_<?php getUrAlbum() ?>">
    <body class="top_album_<?php getUrAlbum("mariages") ?>">
    <body class="top_album_<?php getUrAlbum(mariages) ?>">
    <body class="top_album_<?php getUrAlbum($album) ?>">
    none of them work - I get top_album_(empty) . What should I replace "$album" with ?
  • acrylian Administrator, Developer
    If you want it to be printed you need use `<?php echo getUrAlbum($album) ?>`.
  • I've tried `<?php echo getUrAlbum($album) ?>`, but I still get no result - it's just empty. You can see a gallery page here.

    The image is the album "mariages", which is in the album "laeticia". I need to get that top album printed. Any ideas ?
  • acrylian Administrator, Developer
    You need to pass the album object of the current album to that function (sorry forgot to say but it's actually documentated):
    `getUrAlbum($_zp_current_album);`
  • still no success - worse, it actually makes everthing coming after `<body id="page_album" class="top_album_` totally disappear from the html source code (so page content is gone)... What am I doing wrong ?
  • the zenphoto files (index.php, zp-core folder etc) are in the root folder - could this be the problem ? (or the fact that php safe mode is still on ?)
  • You should review the function definition/documentation for that function. It returns an album object, not a string. Try `$album = getUrAlbum($_zp_current_album); echo $album->name;`

    Generally, it is a good idea to read the documentation on functions you intend to use. Don't expect the developers to remember details while reading posts.
  • Thank you sbillard and acrylian. My body element now looks like this: `name; ?>">` - it works.

    Sorry for my ignorance. Thanks again.
Sign In or Register to comment.