Current location: Hot Scripts Forums » Programming Languages » PHP » PHP displaying in .HTML file


PHP displaying in .HTML file

Reply
  #1 (permalink)  
Old 12-31-06, 01:02 PM
tennis4you tennis4you is offline
New Member
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
PHP displaying in .HTML file

I have a phpBB forum running on my website and I would like to be able to display the latest topic titles of my forum onto my homepage which was built using .html not php.

I downloaded the phpBB Fetch All today (from phphacks) in hopes to pull it off. I used the "simple.php" example, took out some information so I could just display the title of the post and the # of replies. It worked great, but only as a .php file. I saved the file in a different folder on my website and the path to the forum is correct. I then copy and pasted the .php info into an .htm file and it does not work. It says the hack is able to work in non-php websites but I am not sure how to get it to do so.

Again, as long as the file extension is .php it works perfect in the directory I want it to. But as soon as I put it in a .htm extension (in the same directory) file it will not work.

Any help would be greatly appreciated. I am lost.

Thank you,
Reply With Quote
  #2 (permalink)  
Old 12-31-06, 01:18 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
By default, web servers do not parse files with .htm/.html extensions as PHP code. This can be done by configuring your web server to treat .htm/.html extensions as PHP. The configuration changes that accomplishes this varies by web server type.

You can also use an iframe to include the .php web page content into your .htm/.html web page.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #3 (permalink)  
Old 12-31-06, 01:26 PM
tennis4you tennis4you is offline
New Member
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
That is helpful, thank you! I am not sure what an iframe is yet, but I will go research it now and see if I can pull it off. I appreciate the help!
Reply With Quote
  #4 (permalink)  
Old 12-31-06, 02:03 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You can also save this as htaccess in the main directory, and parse php code in html files.

Code:
AddType x-httpd-php .php .htm .htm
Reply With Quote
  #5 (permalink)  
Old 12-31-06, 02:25 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
You only need .htm once, Nico meant:
Code:
AddType x-httpd-php .php .html .htm
__________________
The toxic ZCE
Reply With Quote
  #6 (permalink)  
Old 12-31-06, 03:29 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Thanks Keith.
Reply With Quote
  #7 (permalink)  
Old 12-31-06, 08:17 PM
tennis4you tennis4you is offline
New Member
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Nico
Thanks Keith.
That worked perfect! Thank you!!!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP write to text file veeco Script Requests 2 02-10-10 02:48 PM
PHP File Upload/User Manager Script Needed Computra Script Requests 2 11-09-05 02:39 PM
PHP based File Tracker project valtea Script Requests 0 09-08-05 02:04 PM
PHP - string replace in a text file andrewvideo Script Requests 0 06-20-05 08:04 AM
Writing to .txt file in php 897236489 PHP 3 06-20-05 01:25 AM


All times are GMT -5. The time now is 05:51 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.