468,257 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

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 1707
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by cirillo_curiosone | last post: by
reply views Thread by Boris Ammerlaan | last post: by
9 posts views Thread by Patient Guy | last post: by
5 posts views Thread by serge calderara | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.