PHP code to identify album and image pages

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:

<?php if (function_exists('printFBComments')) { ?>
<?php if (isAlbumPage() or isImagePage) { ?>

<?php printFBComments(); ?>

<?php } ?>
<?php } ?>

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

Comments

  • acrylian Administrator, Developer

    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.

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

  • acrylian Administrator, Developer

    Yes

  • Thanks again.

Sign In or Register to comment.