Using multiple album.php

Is it somehow possible to include a piece of code somewhere that does:
`if albumname equals "illustration" or "photography" or "paintings", use album.php,

else if albumname equals (everything else) use album2.php`
?

That would be lovely - and save me from having to install zenphoto twice! (This is because I want the thumbnails on the illustration etc. pages to look very different than those on the other pages..)

Comments

  • trisweb Administrator
    If the changes aren't _that_ drastic, you could even do that switch in album.php itself.

    `if($_zp_current_album->getFolder() == "foldername") {

    // Do special thumbnails

    } else {

    // Do regular thumbnails.

    `

    Otherwise, if you want to separate other things, hack your index.php (in the root zp directory) to look something like this around these lines

    `...

    if (in_context(ZP_IMAGE)) {

    include("$themepath/$theme/image.php");

    } else if (in_context(ZP_ALBUM) && $_zp_current_album->getFolder() == "specialfolder") {

    include("$themepath/$theme/albumspecial.php");

    } else if (in_context(ZP_ALBUM)) {

    include("$themepath/$theme/album.php");

    } else if...

    `

    The one with the folder check has to come before the one without.

    Good luck!
  • Could this work with sub-albums, using `getParent`?
  • trisweb Administrator
    Absolutely.
  • Great! But...

    If you have the following directory structure...

    * albums

    ** collections
    *** aw05
    *** aw06
    *** ss05
    *** ss06
    *** etc.

    ** press
    *** elle-02.2007
    *** vice-06.2006
    *** etc.

    --

    ... and if you wanted to use, eg. a custom `image-press.php` template for anything in the press directory, you'd need to do a check for every possible parent (elle, vice, etc.).

    Or is there a function to check the 'root' parent?

    Thanks :)
  • trisweb Administrator
    `getAlbumArray($album->name)` will give you an in-order array of the album path, just check the first element.

    Alternatively you can just search for the folder name in the path;
    `if (strpos($album->name, "myalbumname/") !== false)`
    Either way will work.
Sign In or Register to comment.