Kryptronic Software Support Forum

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.

#1 11-05-2010 03:12:08

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Fun With Meta Titles and Descriptions - How Do I Do This?

I have the following code snippets designed to prevent duplicate meta titles and descriptions from being indexed by Google (mainly) when indexing my  pages:


Code:

<?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>';

} ?>

Code:

<?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

 

#2 11-05-2010 19:10:46

xoithitquay
Member
Registered: 11-05-2010
Posts: 4

Re: Fun With Meta Titles and Descriptions - How Do I Do This?

$ns        = $this->globals('khxc.namespace');
$proddisp  = $this->globals('ecom.prod_proddisp');

if (!empty($proddisp['descshort'])) {


Offline

 

#3 11-06-2010 02:26:03

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: Fun With Meta Titles and Descriptions - How Do I Do This?

Thanks, but perhaps you should spend more time on your coding technique and less time spamming forums.

Offline

 

Board footer