Jump to content

different meta description different pages?


$php_mysql$

Recommended Posts

so i set names for every pages, like

 

$pageName = 'home'; //index page

 

  if($pageName == 'categories'){ 
  $find = "Birds & Bees";
  $result = strpos($title,$find);
  echo '1';
  }else if($pageName == 'categories'){ 
  $find1 = "Money & Honey";
  $result = strpos($title,$find1);
  echo '2';  
  }

 

now the issue is with categories.php page, which is just one page but displays different title and according to matching title i wish to change the description but its not happening, everywhere only 1 prints, why?

if($pageName == 'categories') <------   $pageName == 'categories'
  {   $find = "Birds & Bees";  $result = strpos($title,$find);  echo '1';  }
  else if($pageName == 'categories')<---------------- $pageName == 'categories'
  {   $find1 = "Money & Honey";  $result = strpos($title,$find1);  echo '2';    }

 

borth IF statement you are checking same variable

well in categories.php i set a name as

 

$pageName = 'categories';

 

the the links to categories goes like index.php?category=birds_bees or index.php?category=honey_money and i set it in a variable like

 

$title = $_REQUEST['category'];

 

so with every different link the category name changes now i want to match those words which are preset like honey and money or birds and bees and the change page description, what option do i got?

<?php
$title = $_REQUEST['category'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content= "<? echo $title ; ?>." />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

lol no mate not that :-D i want

if(name in $title == 'Birds & Bees'){
echo '<meta name="description" content= "Some description  for birds and bees." />';
}else if (name in $title == 'Money & Honey'){
echo '<meta name="description" content= "Some description  for Money & Honey." />';
}else{
echo '<meta name="description" content= "Default description." />';
}

the issue is getting matching names  Money & Honey or Birds & Bees from $title

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.