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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.