1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP vs. SHTML

Discussion in 'Programming' started by Will.Spencer, Aug 25, 2004.

  1. #1
    I have a site which is built using .shtml. I do not want to convert the entire site to PHP.

    That being said, I do want to use some PHP, and I am having a wee bit of trouble.

    I have a page, How do I find the Page Rank for my site? which calls a PHP file Check Google Page Rank.

    The PHP script completely ignores the .shtml include directives, such as:

    
    <!--#include virtual="header.shtml" -->
    
    Code (markup):
    When I use PHP includes, the data is included, but the formatting is horribly mangled:
    
    include('header.shtml');
    
    Code (markup):
    When I change the file extension from .php to .shtml, the script displays instead of executing.

    I've tried lots of tweaking with Apache's httpd.conf file, but I am just not getting it right.

    httpd.conf has these lines in it currently:
    
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .shtml
    
    Code (markup):
    I removed these lines, because they caused all PHP to be displayed instead of executed:
    
        AddType text/html .php
        AddHandler server-parsed .php
    
    Code (markup):
    Everything works right if I copy the contents of the include files into the PHP file manually. That is a very bad solution, however, because the include files change constantly.

    Anyone seen/done this before?

    What am I missing? :confused:
     
    Will.Spencer, Aug 25, 2004 IP
  2. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That's the form I would expect to work. What form does the mangling take?
     
    Owlcroft, Aug 25, 2004 IP
    vagrant likes this.
  3. Will.Spencer

    Will.Spencer NetBuilder

    Messages:
    14,789
    Likes Received:
    1,040
    Best Answers:
    0
    Trophy Points:
    375
    #3
    Ahh... Owlcroft... that was just exactly what I needed.

    I modified the .shtml to include not one but four PHP sections, so that each .shtml include was called from exactly the right <div> section.

    Now all of the text and graphics appear in the correct places, even if the code does look a bit odd.

    :)
     
    Will.Spencer, Aug 26, 2004 IP
    vagrant likes this.
  4. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #4
    All's well that ends well.
     
    Owlcroft, Aug 26, 2004 IP
  5. liaos

    liaos Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi, I am working on a school website, and I have the similar problem.
    However, from the replies posted, I don't really understand what is the solution.
    Can someone help me?
    ^_^

    Basically, I have a site built in shtml with a virtual include files for the drop down menu on each page
    <!--#include virtual="/menu-only.htm" -->

    However, the 2 areas (calendar and search) which use php doesn't seem to display the drop down menu/navigation in IE.

    regular page:
    http://www.sabrinaliao.com

    calendar page:
    http://sabrinaliao.com/calendar/index.php
    (when using IE, the top navigation will not show)

    So how should I work around with this?
    Can anyone help?!!!

    Really appreciate for your assistance.

    - Sabrina
     
    liaos, Jan 29, 2006 IP
  6. Breckenridge

    Breckenridge Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I see the menu system just fine with my browser, i don't use IE though.

    PHP is a server side scripting language that simply generates a mix of html, css and client side scripting code. If you see the drop down in one bowser and not in the other then the problem is not PHP related.

    Check you html output and verify syntax. Make sure that all of your tables and divs are formated properly.
     
    Breckenridge, Jan 31, 2006 IP
  7. rajeev_seo

    rajeev_seo Peon

    Messages:
    211
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yes. There is no difference as far as the search engines are concerned.


    Yes.

    Use PHP as it will allow you to add more functionality later on if you so desire.
    __________________
     
    rajeev_seo, Apr 24, 2011 IP