Quick Search for:  in language:    
PHP,HTML,Article,will,know,include,file,insid
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
PHP Stats

 Code: 107,779. lines
 Jobs: 40. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for PHP.
Click here to see a screenshot of this code!RepleteSurveys
By Steve Schoenfeld on 1/7

(Screen Shot)

gameserver query
By tombuksens on 1/5


Random Password Generator
By Domenic Matesic on 1/3


Accessing MySQL with PHP
By Ahmed Magdy Ezzeldin on 1/1


Click here to see a screenshot of this code!Debug Window
By Hohl David on 12/30

(Screen Shot)

Click here to see a screenshot of this code!Add Google search technology to your site without Google branding.
By Sean Cannon on 12/29

(Screen Shot)

PHP System Function
By Ruben Benjamin on 12/29


Click here to put this ticker on your site!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

PHP IN HTML

Print
Email
 

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
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
6/18/2003 10:14:16 AM:A1Programmer
I would much prefer including HTML in PHP.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/19/2003 6:57:29 AM:JccSoft
Lol
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/19/2003 11:21:23 AM:MavDude
lol.. genius
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/19/2003 11:52:29 AM:ICode
One small problem... IFrames are only supported by IE :(
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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. -.-
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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 :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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... =)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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...!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/5/2003 10:01:12 PM:
i agree with
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/10/2003 9:42:56 AM:flump cakes
you could just use < script type="php"> codehere
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
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.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | PHP Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.