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.
We don't have a function for "is_home" for the homepage but there are several ways to check this:
$_zp_gallery_page which returns the theme page name you are on.index.php for the home page in this case.in_context(ZP_INDEX)Zenpage itself has some functions like this though (is_News, is_NewsArticle etc.)
Yeah, I knew the $_zp_gallery_page variable, only reason I can't use this one is because sometimes people have something other than index.php set as their root page. So there's no reliable way to assure that would always work correctly.
Does the in_context(ZP_INDEX) take this into account? (the index option from admin backend)
The Zenpage theme for example calls any other Zenpage page set as homepage within the theme's index.php. So it should work then as it is still the index.php page (unless I am really mistaken - I guess I never tried to check it).
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.
Yeah, I had already toyed with the WEBPATH idea, but does WEBPATH take into account if somebody installs into a directory and not the root of a site?
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.
Yes, WEBPATH is the partial path to your install so either '/' or '/folder'. There is also FULLWEBPATH which includes the domain as well. (and there is also SERVERPATH for the real webroot).
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?
Here's what I'm currently using that isn't working, no matter what page it's on it is using the else statement:
// 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.
Just to be clear on what $_zp_gallery_page contains--it is the script name of the theme script that is being run. So if there may be "qualifiers" needed to know what the content being displayed is.
For instance, for album.php you would need to also use the $_zp_current_album variable. Or for Zenpage pages, as acrylian suggests.
So then $_zp_gallery_page displays the theme script, so if they've moved to the album page $_zp_gallery_page should be 'album.php' etc then?
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