I have a 50 page site that uses PHP. Im looking at making meta descriptions for each page. Now the easiest way I can think of is using cases. Now Im looking at just doing cases based on the URL. So the depending on the URL I can enter a varialble for the meta description. Heres the basic idea but it dont work. <?php switch ($_SERVER["PHP_SELF"]) { case "/page1": $description = "page 1 description"; break; case "/page2": $description = "page 2 description"; break; case "/page3": $description = "page 3 description"; break; } ?> PHP: Could anyone help me complete my idea. Im a little confused on what to use for the switch. Thanks
$_SERVER["PHP_SELF"] referrers to the filename, and not the request URI. it should look more of less like: <?php switch (basename($_SERVER["PHP_SELF"])) { case "page1.php": $description = "page 1 description"; break; case "page2.php": $description = "page 2 description"; break; case "page3.php": $description = "page 3 description"; break; } ?> PHP: Just echo $_SERVER["PHP_SELF"] and you'll see what you get, and what you need as case.