check whether on product page or category - Magento

The easy and fastest way to check whether you are on product page or category page is to check the registry to see if we have a single product that we are looking at:

<?php 

if(Mage::registry('current_product')) {
  
  echo "You are on product page" ;

} else {
  echo "You are outside the product page";
}

?>

For any Category / Product page, you are getting the ID from

How to Validate email in drupal webfrom

To validate emails in drupal webfroms, simply add the following PHP code to web form settings (Additional Validation section)

  
<?php 

$email_address = $form_state['values']['submitted_tree']['email_address'];
if (!valid_email_address($email_address )) {
  form_set_error('submitted][email_address', t('The email address appears to be invalid.'));
}

?>

Make a Div a clickable area

How to make a div a Clickable area?

Display facebook, twitter or linkedIn icons using divs:


.footer  .social .twitter  { float:left;   background: url(../images/twitter-icon.gif) no-repeat left;  width: 35px; height:34px;  }
.footer  .social .facebook { float:left;   background: url(../images/facebook-icon.gif) no-repeat left; width: 35px; height:34px;   }

/* Make Divs clickable */

.footer  .social .twitter a  { display: block; height: 100%; width: 100%; }
.footer  .social .facebook a { display: block; height: 100%; width: 100%; }

Enhance your shopping cart appearance with professional ecommerce templates and graphics.

Largest Selection of Ecommerce Templates

Premium templates with unique professional designs, variety of layouts, improved navigation, AJAX empowered, product highlights, refined search, and more.