Jump to content

Dynamic meta description and title


kade119

Recommended Posts

Define them as variables before including the header page, and just echo them out in the included script.

 

<?php
$title = "Some String of stuff";
$desc = "Some other string of stuff";
include('header.php');
//body 
include('footer.php');
?>

Link to comment
Share on other sites

With meta-tags always a good idea to set default options because as your website grows there's a good chance they will get over looked.  So use a conditional like:

 

if (!isset($title)){
echo '<title>Default Page Title</title>';
} else {
echo '<title>' . $title . '</title>';
}

 

You might also want to consider using the database to drive the meta tags - particularly if you have any form of catalogue.

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.