ZenphotoCMS Forum
Using multiple album.php - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Using multiple album.php (/thread-970.html)



Using multiple album.php - snagt - 2006-12-13

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..)




Using multiple album.php - trisweb - 2006-12-13

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!




Using multiple album.php - Guest - 2007-03-20

Could this work with sub-albums, using getParent?




Using multiple album.php - trisweb - 2007-03-20

Absolutely.




Using multiple album.php - Guest - 2007-03-21

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




Using multiple album.php - trisweb - 2007-03-21

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.