473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 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 1816
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
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.