I've checked the function reference, but can't find anything that lets me write a conditional statement in e.g. header.php as follows:
if (is_home_page()) { // do something } else { // do something different }
I know I can create a separate index.php file, but it would be neater to have e.g. a single header file that loads e.g. different scripts or styles depending on the context.
Thanks
Well, each theme has a index.php file always... You can use the global variable $_zp_gallery_page to check for the index.php theme page.
In general you have to use the object model to differ album, image or Zenpage page/news contexts. Zenpage items however have is_Pages() and is_News() for hte pages.php and news.php pages.
See the user guide about a tutorial for that. I assume you have read the theming tutorial already.
Thanks acrylian.
Also - is there any way to distinguish between index.php and a separate home page like index-gallery.php?
I have index.php for my 'splash' page and index-gallery.php for my album overview - but $_zp_gallery_page equals index.php for both.
I could get into finding a string in the URL but that's a bit messier.
For the record, here's my solution.
To recap, I have a home/splash page (index.php) distinct from my gallery index page (gallery-index.php) - and I want them to have different body classes, so that the splash gets a background image, and the gallery index doesn't.
In Zenphoto, the $_zp_gallery_page global resolves to 'index.php' on both pages.
So:
`
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$gallery = strpos(curPageURL(), 'gallery');
?>
I see you call gallery-index.php using page/gallery-index. I assumed you have called it within index.php?
In this case it is a normal custom page and should like like one. $_zp_gallery_page should really return gallery-index.php. It does this with all custom pages (archive.php,contact.php,gallery.php of the Zenpage theme) I just tested to be sure.
You can also test manually for $_ GET['p'].
Btw, you are running on the older 1.3 release. The 1.3.1.x release were security bug fix releases and we strongly recommend to upgrade.
PS: Nice site. You should submit to the showcase. Small suggestion: I would implement mousewheel support for the thumbs (I see it is loaded actually but in Firefox & Safari 4.1.2 it does not work):