Personal Loans - Mortgage Calculator - Mortgages - Loans - Myspace Layouts

PDA

View Full Version : PHP vs. SHTML


Will.Spencer
Aug 25th 2004, 1:52 am
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? (http://www.internet-search-engines-faq.com/find-pr-page-rank.shtml) which calls a PHP file Check Google Page Rank (http://www.internet-search-engines-faq.com/page-rank.php?url=http://www.google.com).

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


<!--#include virtual="header.shtml" -->


When I use PHP includes, the data is included, but the formatting is horribly mangled:

include('header.shtml');


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


I removed these lines, because they caused all PHP to be displayed instead of executed:

AddType text/html .php
AddHandler server-parsed .php


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:

Owlcroft
Aug 25th 2004, 7:37 pm
include('header.shtml');

When I use PHP includes, the data is included, but the formatting is horribly mangledThat's the form I would expect to work. What form does the mangling take?

Will.Spencer
Aug 26th 2004, 2:54 am
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.

:)

Owlcroft
Aug 26th 2004, 12:36 pm
All's well that ends well.

liaos
Jan 29th 2006, 2:48 pm
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

Breckenridge
Jan 31st 2006, 9:27 pm
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.