ZenphotoCMS Forum
PHP code to identify album and image pages - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Themes (https://forum.zenphoto.org/forum-5.html)
+--- Thread: PHP code to identify album and image pages (/thread-13027.html)



PHP code to identify album and image pages - undagiga - 16-10-2017

I'm working with seroxatmad's Facebook Like plugin. I had to edit to remove some white space that was causing "Cannot modify header information - headers already sent" errors. I then used it to create a FB comments plugin. I am showing the like button in the header and the comment block in the footer. But I only want them to appear on album and image pages, and not on things like the contact form. I constructed a code snippet based on other pages, and inserted it into inc_footer.php and inc_header.php:

but despite this, I get the comments block on all pages. I take I'm doing something wrong.




PHP code to identify album and image pages - acrylian - 16-10-2017

isAlbumPage() or isImagePage are the wrong functions to use. They check if this is an album page with images and/or subalbums.

You can use the global variable $_zp_gallery_page which would be album.phpor image.php if you are on the related theme page.

That is if the theme used uses the standard theme setup.




PHP code to identify album and image pages - undagiga - 16-10-2017

Thanks. Is that still going to work even if the call is from the header and footer?




PHP code to identify album and image pages - acrylian - 16-10-2017

Yes




PHP code to identify album and image pages - undagiga - 16-10-2017

Thanks again.