he name is the name of the album folder) Actually it is the folder name including the parent album names if a sub album (topevel/sublevel1/sublevel2…).
Just for scuba the structure is parent scuba album - 4 sub albums - 1 subalbum has further 9 subs - each 9 has images.
That will be too much coding. Perhaps no problem for the first time but every time a new album is added the coding will need to be done. e.g. just or 1 scuba album there will be three segments:
if ($_zp_current_album->name == "scuba-diving")
if ($_zp_current_album->name == "scuba-diving/photos")
if ($_zp_current_album->name == "scuba-diving/photos/spain")
+ some code when the image is displayed
I am not yet familiar with functions yet. If it has to be through functions then I guess I'll have to wait before I understand that, unless Fretzl posts some ready made stuff for me to paste
If you need a different image for each album/subalbum there is no way to do it differently. Except you could use either the random images functions or just use the album thumb of each album. There are functions for that.
If you ony want always the same for all "scuba" subalbums as a "section" then use the uralbum function I linked.
In any case you need to get a bit into it as we cannot post examples for everything as you might understand.
The idea is to use de backend (admin) where you only have to fill in the filename of the image you want as header.
This approach assumes that
You want to be able to set a specific header image for every album and/or subalbum.
The images are present in the images folder of the theme.
On the backend all albums have a Codeblocks field.
Go to admin -> albums -> scuba-diving and copy the image filename for the header (for example: scuba.jpg) in Codeblock#1 Hit "Apply". Repeat this for every album and sub-album. Just pick the image you want.
On album.php change `
` to `
)">`
On image.php change `
` to `
)">`
This gets you the header image (as set in the codeblocks) for the specific album page. Images (on image.php) get the same header image as the album they are in.
Once this is set up, all you have to do is set a filename in Codeblock#1 of any new album.
This can also be extended to pages and news (they also have Codeblocks) but requires a slightly different change of the <div id="header"> part in pages.php and news.php.
@acrylian: "Always the same for all "scuba" subalbums as a "section" then use the uralbum function I linked."
Thats exactly what I want i.e.
if (url contains scuba-diving)
{show scuba.jpg as the top header image for parent album and all downpath subalbums right till the image is displayed}
else {header.jpg}
but I dont know how to use the function you linked. I understand the concept of function but since just started php cant write the codes yet. Anyway I understand you cant write codes here for all visitors so its ok. I really appreciate the help I've got in the last few days.
@fretzl: really appreciate your effort, thanks a lot. May you always be in a good mood Regarding the codeblock, it works fine for all the albums and sub-albums however the image code does not work. When you click on the thumbnail to open the image then only a black screen is displayed.
Can you please include the option in the code that if there is nothing in the codeblock then the default header.jpg is displayed, since a new user might not know about the code block.
I am really sorry I am asking too much from you guys but hopefully this is my last design issue.
The usage is actually quite simple. You pass the current album object to it. That is stored in `$_zp_current_album` on album.php and image.php. The function will now return the album object of the oldest ancestor (the top level parent of it) or if it is itself the toplevel the album itself.
So all you need to do is basically: ` $obj = getUrAlbum($_zp_current_album); If($obj->name == 'scuba-diving') { … } `
Just to satisfy my own curiosity here's how to use the codeblocks. (tested this time)
Make sure you have a header.jpg image in your images folder to serve as a default header image.
In Codeblock#1 of the toplevel album paste/write the filename of the image to use as header (for example: scuba.jpg)
On album.php and image.php replace
`
`
with
` <?php $obj = getUrAlbum($_zp_current_album); ?>
getCodeblock(1))){ printCodeblock(1, $obj); } else { echo "header.jpg"; } ?>)"> ` This will get you the same header image for a toplevel album and all subalbums and images therein.
Sorry again for coming in late (out on my flight again).
Cant thank you guys enough. Everything is working fine. The codeblock thing is great as you dont have to mess around with the code everytime a new album is added.
Much appreciated
p.s. where r u guys based. cant find it on the website.
seen this page before, perhaps Germany and Netherlands. Dont fly to these stations anymore. I owe you guys a cup of coffee. I am in Paris today, come over
It is actually the same principe (always the object model). For news articles it is even easier as they don't have parents. However, categories and pages can have parents. There is nothing for the top level item but there are methods to get all parents `->getParent()`. Those return an array you can get the top one from. Then again the object model comes in.
Comments
http://www.zenphoto.org/documentation/core/_functions.php.html#functiongetUrAlbum
But besides that fretzl's way is the right one.
he name is the name of the album folder)
Actually it is the folder name including the parent album names if a sub album (topevel/sublevel1/sublevel2…).
That will be too much coding. Perhaps no problem for the first time but every time a new album is added the coding will need to be done. e.g. just or 1 scuba album there will be three segments:
if ($_zp_current_album->name == "scuba-diving")
if ($_zp_current_album->name == "scuba-diving/photos")
if ($_zp_current_album->name == "scuba-diving/photos/spain")
+ some code when the image is displayed
I am not yet familiar with functions yet. If it has to be through functions then I guess I'll have to wait before I understand that, unless Fretzl posts some ready made stuff for me to paste
Thanks
If you ony want always the same for all "scuba" subalbums as a "section" then use the uralbum function I linked.
In any case you need to get a bit into it as we cannot post examples for everything as you might understand.
Maybe a different approach is easier once set up.
The idea is to use de backend (admin) where you only have to fill in the filename of the image you want as header.
This approach assumes that
On the backend all albums have a Codeblocks field.
Go to admin -> albums -> scuba-diving and copy the image filename for the header (for example: scuba.jpg) in Codeblock#1
Hit "Apply".
Repeat this for every album and sub-album. Just pick the image you want.
On album.php change
`
to
`
On image.php change
`
to
`
This gets you the header image (as set in the codeblocks) for the specific album page.
Images (on image.php) get the same header image as the album they are in.
Once this is set up, all you have to do is set a filename in Codeblock#1 of any new album.
This can also be extended to pages and news (they also have Codeblocks) but requires a slightly different change of the <div id="header"> part in pages.php and news.php.
Thats exactly what I want i.e.
if (url contains scuba-diving)
{show scuba.jpg as the top header image for parent album and all downpath subalbums right till the image is displayed}
else {header.jpg}
but I dont know how to use the function you linked. I understand the concept of function but since just started php cant write the codes yet. Anyway I understand you cant write codes here for all visitors so its ok. I really appreciate the help I've got in the last few days.
@fretzl: really appreciate your effort, thanks a lot. May you always be in a good mood Regarding the codeblock, it works fine for all the albums and sub-albums however the image code does not work. When you click on the thumbnail to open the image then only a black screen is displayed.
Can you please include the option in the code that if there is nothing in the codeblock then the default header.jpg is displayed, since a new user might not know about the code block.
I am really sorry I am asking too much from you guys but hopefully this is my last design issue.
Regards
So all you need to do is basically:
`
$obj = getUrAlbum($_zp_current_album);
If($obj->name == 'scuba-diving') { … }
`
Make sure you have a header.jpg image in your images folder to serve as a default header image.
In Codeblock#1 of the toplevel album paste/write the filename of the image to use as header (for example: scuba.jpg)
On album.php and image.php replace
`
with
`
<?php $obj = getUrAlbum($_zp_current_album); ?>
`
This will get you the same header image for a toplevel album and all subalbums and images therein.
Cant thank you guys enough. Everything is working fine. The codeblock thing is great as you dont have to mess around with the code everytime a new album is added.
Much appreciated
p.s. where r u guys based. cant find it on the website.
http://www.zenphoto.org/pages/zenphoto-team
what changes are required for the pages/news
thanks