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.

Link to comment
Share on other sites

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;
    }



?>

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.