472,954 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

php on html?

Can I add php code directly to an html document or is it possible to
have an include on an html page the read a php document?
If so how would I do it?

Thanks
Dave
Jul 17 '05 #1
8 1805
Dave wrote:
Can I add php code directly to an html document or is it
possible to have an include on an html page the read a php
document? If so how would I do it?

Thanks
Dave


Dave,
Why not do it the other way around? You can embed the HTML in a
PHP file. Just build your PHP program and then add the
following:

echo (" <HTML file goes here> ");

The only problem I have found doing this is that you must either
escape any " characters or limit yourself to ' inside the echo.

HTH
--
Jerry Gitomer
Jul 17 '05 #2
Jerry Gitomer wrote:
Dave wrote:

Can I add php code directly to an html document or is it
possible to have an include on an html page the read a php
document? If so how would I do it?

Thanks
Dave

Dave,
Why not do it the other way around? You can embed the HTML in a
PHP file. Just build your PHP program and then add the
following:

echo (" <HTML file goes here> ");

The only problem I have found doing this is that you must either
escape any " characters or limit yourself to ' inside the echo.

HTH


echo '<HTML "file" goes here>';

I would suggest using templates though. Try Smarty.

Ahh, rookies...
-JI
Jul 17 '05 #3
Jamie Isaacs wrote:
Jerry Gitomer wrote:
Dave wrote:

Can I add php code directly to an html document or is it
possible to have an include on an html page the read a php
document? If so how would I do it?

Thanks
Dave

Dave,
Why not do it the other way around? You can embed the HTML in a
PHP file. Just build your PHP program and then add the
following:

echo (" <HTML file goes here> ");

The only problem I have found doing this is that you must either
escape any " characters or limit yourself to ' inside the echo.

HTH


echo '<HTML "file" goes here>';

I would suggest using templates though. Try Smarty.


I suggest to read the thread:

*Does PHP need the .php extension ?*

just a few lines further down.

--
Markus
Jul 17 '05 #4
ROOKIE!!....Absolutely!! what is Smarty?

The rookie in me is spewing out profusely :-D
Dave


echo '<HTML "file" goes here>';

I would suggest using templates though. Try Smarty.

Ahh, rookies...
-JI

Jul 17 '05 #5
I found it
http://smarty.php.net/

this may be nice but it doesn't help with existing sites

Thanks
Rookie :-)
I think I'll adopt the name
Jul 17 '05 #6
Dave wrote:
ROOKIE!!....Absolutely!! what is Smarty?

The rookie in me is spewing out profusely :-D
Dave
echo '<HTML "file" goes here>';

I would suggest using templates though. Try Smarty.

Ahh, rookies...
-JI


http://smarty.php.net/
Jul 17 '05 #7
Oh, come on, people, let's help the man!

Including an HTML file verbatim in the output is trivial.
simply `readfile("yourfile.html");' will do. According to docs,
`include("yourfile.html")' should have exactly the same effect,
but I haven't tried.

Personally, I find this approach more straightforward than
using templates.

From the shadows,
Felix
Jul 17 '05 #8

"Dave" <dm**@revelationweb.com>
???????:21**************************@posting.googl e.com...
I found it
http://smarty.php.net/

this may be nice but it doesn't help with existing sites

Thanks
Rookie :-)
I think I'll adopt the name


it can be done for changing the associate file in that directory I think is
htaccess or something like that..I can't remember exactly
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
0
by: Boris Ammerlaan | last post by:
This notice is posted about every week. I'll endeavor to use the same subject line so that those of you who have seen it can kill-file the subject; additionally, Supersedes: headers are used to...
9
by: Patient Guy | last post by:
Taking the BODY element as an example, all of its style attributes ('alink', 'vlink', 'background', 'text', etc.) are deprecated in HTML 4.01, a fact noted in the DOM Level 2 HTML specification. ...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
6
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.