For some reason I could have sworn there was a global definition or global variable that held the location of the root location for the zenphoto implementation. But after looking through the global_defs file and the user guide I'm not seeing it.
Is there somewhere this is stored? Or perhaps a function like "isRoot()" (which I didn't notice anything similar) to determine if the visitor is at the root of the zenphoto install?
I'm sure this is just a case of the late-night coding eyes and it's probably something simple I'm missing after the sugar induced coma from Easter.
Basically what I need to do is determine if the user is viewing the Zenphoto root folder so I can change one of the meta-keys properly to reflect if they're at the root or an article/page off of the zenphoto root.
Comments
1. Easiest is to use the global `$_zp_gallery_page` which returns the theme page name you are on.`index.php` for the home page in this case.
2. `in_context(ZP_INDEX)`
Zenpage itself has some functions like this though (is_News, is_NewsArticle etc.)
Does the in_context(ZP_INDEX) take this into account? (the index option from admin backend)
What you mean with the index option? The Zenpage "news on index" option? That is also still index.php.
I fear the index context refers to the top level album list but I am quite not sure right now.
There is also WEBPATH that can be compared to the $_SERVER[] values.
I suppose worst case scenario I can just give them another option to enter the root of the zenphoto gallery's location and compare the current location to that. That's probably going to be the easiest and most reliable/flexible route.
I was surprised to see that the install location is logged somewhere in the zp_options table. I know when I moved from a sub-directory to route with one of my installs I had to re-run setup, but I suppose that was mainly to fix the htaccess file.
And yes, setup does basically only fix the htaccess rewrite base.
So if you load a page wihtin a theme's index.php like Zenpage theme does $_zp_gallery_page is really not = "index.php"? Or which way do you use?
`
// Populate OG:Type as website or article based on if at root page or not.
if ( $_zp_gallery_page == 'index.php' ) {
echo '';
} else {
echo '';
}
`
I haven't instantiated the variable though because my understanding is the gallery_page is already set by the time this is called, perhaps I'm wrong.
`
<?php
// force UTF-8 Ø
if(function_exists("checkForPage")) { // check if Zenpage is enabled or not
if (checkForPage(getOption("zenpage_homepage"))) { // switch to a news page
$ishomepage = true;
include ('pages.php');
} else {
include ('gallery.php');
}
} else {
include ('gallery.php');
}
?>
`
For instance, for album.php you would need to also use the $_zp_current_album variable. Or for Zenpage pages, as acrylian suggests.
It seems the most reliable way to have the plug-in function the same no matter if it's zenphoto with or without zenpage then is to have a variable set via options and just compare the current location against the user-defined variable