Current location: Hot Scripts Forums » Programming Languages » PHP » Adding PHP to HTML


Adding PHP to HTML

Reply
  #1 (permalink)  
Old 11-10-04, 08:23 AM
dmschenk dmschenk is offline
New Member
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Adding PHP to HTML

I would like to add a php counter that I have to an existing html page but am not sure how to do this. or is there a better way?

<? php
include ("counter.php")

but I can't get it to output to the html page

Thanks
Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-10-04, 02:24 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
Firstly its:

<?php
include ("counter.php");
?>

Secondly you put it at the top of the page and make sure the page is a .php file instead of a .html file! The HTML will still work even though its in a .php file, but the PHP wont work if its in a .html file!
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-10-04, 04:00 PM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by FiRe
Firstly its:

<?php
include ("counter.php");
?>

Secondly you put it at the top of the page and make sure the page is a .php file instead of a .html file! The HTML will still work even though its in a .php file, but the PHP wont work if its in a .html file!
getting php to work in a html file is possible.. its just about how you configure the server.. and the include doesint have to be at the top.. it can be where ever in the code.. rest i agree with
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-10-04, 04:32 PM
Wuiqed Wuiqed is offline
Wannabe Coder
 
Join Date: Aug 2004
Location: Sverige
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by <?Wille?>
getting php to work in a html file is possible.. its just about how you configure the server.. and the include doesint have to be at the top.. it can be where ever in the code.. rest i agree with
True, ATM my Apache server is executing PHP code even if it is a file with html/htm extension...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-10-04, 04:33 PM
Eclipse's Avatar
Eclipse Eclipse is offline
Coding Addict
 
Join Date: May 2004
Location: Long Island, New York
Posts: 356
Thanks: 0
Thanked 0 Times in 0 Posts
Or you can set up a layer under an images with a small frame or Iframe..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-10-04, 05:51 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
yeh i notice on hotscripts.com everything is .html and i did wonder how it all worked...
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 11-11-04, 12:00 AM
phprogramming phprogramming is offline
Wannabe Coder
 
Join Date: Nov 2004
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
it could also generate an html page automatically
__________________
Source Code Talk - Programming Discussion, Tutorials, and More!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
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 in HTML Pages? ZeoFateX PHP 19 01-04-06 07:42 PM
Adding PHP to HTML dmschenk PHP 2 11-10-04 04:34 PM
PHP to calculate HTML forms jamesian PHP 1 10-25-04 08:45 AM
Can PHP place quotes around HTML attributes frdmsun PHP 1 08-17-04 03:12 AM
Adding html to a php file Sal Collaziano PHP 4 05-15-04 01:15 PM


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