Results 1 to 4 of 4

Thread: "meta description" tags and PHP

  1. #1

    "meta description" tags and PHP

    hello.. i just have a question about using
    Code:
    <meta name="description" content="Site Description Goes Here" />
    this would work well when using a static html page... since the SE robots will get a chance to "crawl" the site and read the meta tags.. (am i right??)

    however, what if your index page is not "index.html" but rather "index.php"..
    can search engines still pick up your site description?

    for example, "index.php" would contain pure PHP code that would go something like
    PHP Code:
    <?php

    $typeOfPage 
    $_GET['tp'];

    switch(
    $typePage)
    {
        case 
    "home":
            
    setUpRegularPage();
            break;
            
        case 
    "contact_us":
            
    setUpRegularPage();
            break;
            
        default:
            include(
    "splash.php");
            break;
    }

    function 
    setUpRegularPage()
    {
        include(
    "variable_definitions.php");
        global 
    $typeOfPage;
        echo 
    $htmlDeclaration;
        include(
    "header.php");
        
            switch(
    $typeOfPage)
            {
                case 
    "home":
                include(
    "home.php");
                break;
                
                case 
    "contact_us":
                include(
    "contact_us.php");
                break;
            }
            
        include(
    "footer.php");
    }

    ?>
    the $htmlDeclaration variable contains the " <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="description" content="Site Description Goes Here" />
    </head> etc..... etc..."

    are the search engine robots still going to find the site description?
    Last edited by ThreeDollarBill; October 9th, 2009 at 07:01 AM.

  2. #2
    the search bots will only look at the html, and can never find out how that html is constructed... in other words, no matter what you do, its the final html output that counts...

    so if your php/asp/anything creates a normal html page with all the normal things you would expect, it will work just as any other html page.

    so the short answer, yes

    You can never underestimate the stupidity of the general public.

  3. #3
    Quote Originally Posted by RvGaTe View Post
    the search bots will only look at the html, and can never find out how that html is constructed... in other words, no matter what you do, its the final html output that counts...

    so if your php/asp/anything creates a normal html page with all the normal things you would expect, it will work just as any other html page.

    so the short answer, yes
    oh ok.. thanks for the info... cause i've always thought that the html pages that php pages render are there "just for that time being" that you are accessing them.. once you leave the site, i've always thought that the html page generated will be gone, leaving no trace / html page for the SE to "crawl" onto...

    i just don't understand the logic of how the SE can crawl your site when the only files on your server are PHP files (sorry, a bit of a newbie here).. the only time the HTML content will be generated is when you run those PHP files..

    so, assuming the SEs check out the files on your public_html folder, all it will see are a bunch of PHP files.. so how does it work?

  4. #4
    PHP doesn't actually create html files.

    Basically, when you go to a page, the browser always says "Hey, I'm gonna sit here and wait for some html to render". (except IE says "Hey, I'm gonna sit here and wait for some html to render, but then render something else"). When you're looking at a straight up .html file, apache sends down the html. Imagine that the html is in a big string that get's sent to the browser.

    However, when you view a php page, on the server that is serving the page, the php interpreter runs the php code. What ever the php ouputs then get's piped to the browser via apache.

    Example:

    Let's say you have index.html which looks like this:

    HTML Code:
    <html>
    <head>
    <title>Tyler is super cool</title>
    </head>
    </html>
    The browser get's "<html><head><title>Tyler is super cool</title></head></html>"

    And if you have index.php like so:
    PHP Code:
    <?php
    echo "<html>";
    echo 
    "<head>";
    echo 
    "<title>Tyler is super cool</title>";
    echo 
    "</head>";
    echo 
    "</html>";
    ?>
    The php out puts "<html><head><title>Tyler is super cool</title></head></html>".

    Therefore the browser gets the same thing. The php doesn't make a file at all.

    And substitute the google spider for the browser and it works the exact same way.

    NOTE: This is a vastly simplified explanation.
    NOTE: Tyler really is super cool.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012