Reputation: 697
I have right now a .html document that I copy to new directories..
My question is : Is there a way to put text in the .html document between the <body>
and </body>
tags?
I'm sorry for this question, I mean with the short explaination, but I have searched everywhere.
Upvotes: 0
Views: 131
Reputation: 15856
yes you can using PHP fopen()
read method , append whatever text you want using file_put_contents()
, then save file to your server :
source: http://www.w3schools.com/php/php_file.asp , http://www.w3schools.com/php/func_filesystem_file_put_contents.asp
Upvotes: 1
Reputation: 8457
On a web server running PHP, .PHP
files are always processed through the PHP managed handler (decoder, sort of) and that INCLUDES a standard HTML processor. So, you can, without question, combine PHP and HTML in a single file. The key is proper placement of the scripted code and the HTML code.
An example of your "work" would be very useful here.
Upvotes: 1
Reputation: 35220
Not if is an .html document. ...Well, yes, but it requires altering server settings and it's really bad practice.
If you change it to a .php file. Then yes it's possible.
You would have something like this:
<body>
<?php
echo 'Hello World <br />';
/*$content is something you would have defined earlier on
(it doesn't have to be called '$content' though) */
echo $content;
?>
</body>
Upvotes: 0