Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Detecting page in template_top!


kohalabill

Recommended Posts

I am trying to detect the page such as product_reviews, so I placed the following code in template_top so it would be in the head of the page.

<?php
 $testPage = $_SERVER['PHP_SELF'];   
if (stristr($testPage, 'product_info.php')){
 echo '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
 <link rel="stylesheet" type="text/css" href="ext/jquery/fancybox/jquery.fancybox-1.3.4.css" />
 <script type="text/javascript" src="ext/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>';
}elseif (stristr($testPage, 'product_reviews.php')) {
 echo '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">';
}
?>

 

It seems really strange because I am able to use this inside the page itself:

<?php
 $testPage = $_SERVER['PHP_SELF'];  
if (stristr($testPage, 'product_info.php')){
 echo $testPage;
}
?>

 

I'm sure its scope related, but any ideas how I could implement this?

 

Thanks,

Bill

Link to comment
Share on other sites

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...