Jump to content

echo text based on the url


PlagueInfected

Recommended Posts

Personally I would code it like this;

 

<?php
    $filename = substr($_SERVER["SCRIPT_FILENAME"], strrpos($_SERVER["SCRIPT_FILENAME"], "/") + 1);
    switch($filename)
    {
        case "index.php":
            echo "Plague Infected | Index";
        break;

        case "contact.php":
            echo "Plague Infected | Contact";
        break;

        case "portfolio.php":
            echo "Plague Infected | Portfolio";
        break;

        default:
            echo "Plague Infected Designs | Freelance art and web design and development in Fort Worth TX and Puerto Rico";
        break;
    }
?>

 

But that's just me anyway.

Josh, why dont you rewrite the page with pg= or p= like you did with the other things.

 

 

then when you have done that output like so

 

<title><?php echo $page;?>
</title>
<?php
$page= $GET['pg'];

switch($page)
    {
    case ($page=="index");
            echo "Plague Infected | Index";
        break;

        case($page=="seo"):
            echo "Plague Infected | Contact";
        break;

case ($page=="portfolio"):
            echo "Plague Infected | Portfolio";
        break;

        default:
            echo "Plague Infected Designs | Freelance art and web design and development in Fort Worth TX and Puerto Rico";
        break;
    }



?>

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.