You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I have the following code snippets designed to prevent duplicate meta titles and descriptions from being indexed by Google (mainly) when indexing my pages:
<?php $ns = $this->globals('khxc.namespace'); $proddisp = $this->globals('ecom.prod_proddisp'); if (!empty($proddisp['name'])) { $descitem = $proddisp['name']; } if ($ns == 'prodidx') { print '<title>' . $descitem . '</title>'; } else { print '<title>' . $metatitle . '</title>'; } ?>
<?php $ns = $this->globals('khxc.namespace'); $proddisp = $this->globals('ecom.prod_proddisp'); if (!empty($proddisp['descshort'])) { $descitem = $proddisp['descshort']; } if ($ns == 'prodidx') { print '<meta name="description" content="' . $descitem . '" />'; } else { print '<meta name="description" content="' . $metadesc . '" />'; } ?>
It is a crude solution, but both code blocks work. However, I would like to take things further by randomizing the output in the event of there being more than one product on a page. - I have already tried placing the variable into an array and then using , but that did not work ...so what would be the best way of obtaining a random output with these items?
Last edited by Design_Wholesale (11-05-2010 03:13:32)
Offline
$ns = $this->globals('khxc.namespace');
$proddisp = $this->globals('ecom.prod_proddisp');
if (!empty($proddisp['descshort'])) {
Offline
Thanks, but perhaps you should spend more time on your coding technique and less time spamming forums.
Offline