Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP Page Titles

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39641
    RSmiroldo
    Member

    I’m sure this is a novice problem but I can’t figure it out..

    I currently used one php file (index2.php) to call the content into the body of the layout using this php include

    
    if (isset($_GET)) {
    if (file_exists($_GET . '.txt')) {
    include $_GET . '.txt';
    }
    }
    ?>

    my question is that within the content how do I give those pages (about us, testimonials, tax services, etc.) there own titles instead of it defaulting to the index2.php title? I’m trying to be SEO friendly and I know having the same title on every page isn’t going to help my cause. Thanks in advance for your assistance.

    #109157
    chrisburton
    Participant

    Set a body id. Then depending on that id write an if-statement echoing the title.

    #109158
    RSmiroldo
    Member

    Not to sound dumb but how would I do that?

    #109162
    terryboxer
    Member

    I’m still learning, but a simple way I’m using at the moment is using $_GET method from the page url and the page link clicked:




    if ($_GET == 'home'){
    echo ('Website :: Home');
    }
    else if ($_GET == 'contact'){
    echo ('Website :: Contact');
    }
    ?>


    Home

    Contact


    #109150
    RSmiroldo
    Member

    It works, greatly appreciated!

    #109151
    terryboxer
    Member

    I hope you learn from it. You’re welcome.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.