| | Submitted on: 6/18/2003 4:02:59 AM
By: G.Ajaykumar
Level: Intermediate User Rating:
By 10 Users Compatibility:PHP 3.0, PHP 4.0
Users have accessed this article 4609 times. | (About the author) |
| | <font face=arial color=green size=4>PHP IN HTML</font>
This Article , will let you know how to include a php file inside a html file ,
using inline floating frames. | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. |
PHP IN HTML |
This Article , will let you know how to include a php file inside a html file
seamlessly, using inline floating frames.
Iframes are simple floating frames (HTML TAG) which can be placed at any required location on a html file. Iframe are said to be faster rendering, less memory, and faster scrolling. They can be stacked over other inline floating frames, Iframes can contain transparent content.
Iframe has an important attribute called as src which acquires the filename to load inside the Iframe, using this attribute you can specify the PHP file to load inside the IFRAME,
Which will resemble as if ,a HTML file were executed .
This technique is applied in many area , one of which is a news portal , which usually generates a static html file as home page and other content pages to save the bandwidth and cope with the heavy load . There is a location where they keep updating the Breaking news . Applying Php in HTML technique will be very useful , in this case , where php file might dynamically perform a dynamic operation to fetch the dynamic content .
and Iframe to display the dynamic contents with in a HTML page.
Let me explain practically how this works out
Create two file named
Test.htm
Test.php
Code for Test.htm
<html>
<head>PHP in HTML<head>
<body>
<h2><font face="arial" color="green"></font></h2><br><br>
<Iframe src="Test.php" width="300" height="600"></Iframe>
</body>
</html>
Code for Test.php
<?phpinfo();?>
Description : Test.htm contains contains the tag Iframe in it , the attribute src="Test.php" of the Iframe Sets or retrieves a URL to be loaded by the object Iframe .
Width and height attributes specifies the width and height of the Iframe in pixels or in percentage.
Coming to the Test.php , <?phpinfo?>this script displays the php configuration file .
Put the files in your webserver root folder (ie wwwroot folder)
Now run the Test.htm, you will be able to see the Test.php loaded inside the Iframe, on the Test.htm
This technique can be applied to include any file into HTML file |
Article By |
G.Ajaykumar |
Jr. Systems Analyst |
Ferntech Systems Pvt. Ltd |
| |
Other 1 submission(s) by this author
|
|
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
6/18/2003 10:14:16 AM:A1Programmer I would much prefer including HTML in
PHP.
|
6/19/2003 6:57:29 AM:JccSoft Lol
|
6/19/2003 11:21:23 AM:MavDude lol.. genius
|
6/19/2003 11:52:29 AM:ICode One small problem...
IFrames are only
supported by IE :(
|
6/19/2003 11:55:48 AM:FirebirdDE It is really possible to connect Html
with Php ? Wow. I wonder why this great
feature isn't listed in php.net's
feature list.
-.-
|
6/19/2003 1:21:15 PM:Ryan K. it would be eaiser to put:
AddType
application/x-httpd-php .htm .html
to
a .htaccess file :)
|
6/19/2003 4:47:09 PM:Mike Glover i agree to that last one, hah, because
it is what i have done on my server...
=)
|
6/21/2003 9:22:49 PM: WONDERFUL...!!!!!!!
I use it to
refresh an encrypted php file which
work only if I refresh it
in the
browser
Thanks a lot for this
article...!!!
|
6/22/2003 1:09:04 PM:Ryan K. to the comment above: php is server
side it's obviously not going to change
until you refresh the page..
|
6/24/2003 3:31:05 AM:hardanro This iframe things is used in many
traffic sites, which use a small image
(which is backed-up by a php script),
in the referer page to find
informations about the visitors of that
page (ip, where they came from,time
etc). Also is used in banners
managament.
|
7/5/2003 10:01:12 PM: i agree with
|
7/8/2003 10:41:33 AM: Problem with the .htaccess method is if
you also put set it up to parse,say
.html for SSI, you can't set .html to
go thru the php processer as well..just
don't work..drove me nuts for 3
days..lol...
|
7/10/2003 9:42:56 AM:flump cakes you could just use
< script
type="php">
codehere
|
7/10/2003 1:27:23 PM: well, you have a nice article. but you
can consider this article as a guide in
practicing your skill in php and html.
just my thought...
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|