Hi,
Summary:
Best way to divide out the HTML and PHP in some code I inherited. How can I
keep the HTML files separate?
Full Details:
I've now been working two weeks on PHP / MySQL code I inherited and the
client is a happy bunny. This was my first crash course outing with PHP, but
with basic PERL experience found it fairly easy to pick up and used the code
I inherited as my guide.
However, the current code has every page as being top half php, bottom half
HTML (with some embedded PHP where necessary)
Eg.
START OF FILE
<?php
do some general processing to set up variables
?>
<HR>
<!--HTML CODE-->
<!-- note that the current code does not even output a HTML HEAD tag - any
reason why this might be?--?
<? occasional bit of PHP ?>
<P>
End of HTML
END OF FILE
The HTML pages are ugly and they have very much hard coded formatting
information in them.
Hence the application is entire need of an overall.
What is the best way to approach this?
I really would like to keep the HTML parts in another file so they could be
editing in programs like dreamweaver to be honest. I obviously want to role
out the use of CSS so that I can change the look and feel quickly.
Is there a command in PHP that when the main processing is done you can
reference another file which contains HTML to be displayed but none of the
current variable information is lost.
I say this because if I use the header(location :) command I have to repost
the form variables which is pain.
Ideally I could just have the main PHP bit in the code, and when it is done
it references a HTML page that is displayed(That HTML page may contain
snippets of PHP). So functionally things still work as they are, but it lets
me put the HTML in a physically different file.
I hope this makes sense.
Thanks in advance.
Kind regards
Dave
PS: Having just written this, I then tried to open one of my PHP files in
dreamweaver and what do you know, it opens and of course handles the PHP.
Still I still think the question is valid and maybe I will be told it is not
a good idea to use Dreamweaver to manage code with PHP in it.
Summary:
Best way to divide out the HTML and PHP in some code I inherited. How can I
keep the HTML files separate?
Full Details:
I've now been working two weeks on PHP / MySQL code I inherited and the
client is a happy bunny. This was my first crash course outing with PHP, but
with basic PERL experience found it fairly easy to pick up and used the code
I inherited as my guide.
However, the current code has every page as being top half php, bottom half
HTML (with some embedded PHP where necessary)
Eg.
START OF FILE
<?php
do some general processing to set up variables
?>
<HR>
<!--HTML CODE-->
<!-- note that the current code does not even output a HTML HEAD tag - any
reason why this might be?--?
<? occasional bit of PHP ?>
<P>
End of HTML
END OF FILE
The HTML pages are ugly and they have very much hard coded formatting
information in them.
Hence the application is entire need of an overall.
What is the best way to approach this?
I really would like to keep the HTML parts in another file so they could be
editing in programs like dreamweaver to be honest. I obviously want to role
out the use of CSS so that I can change the look and feel quickly.
Is there a command in PHP that when the main processing is done you can
reference another file which contains HTML to be displayed but none of the
current variable information is lost.
I say this because if I use the header(location :) command I have to repost
the form variables which is pain.
Ideally I could just have the main PHP bit in the code, and when it is done
it references a HTML page that is displayed(That HTML page may contain
snippets of PHP). So functionally things still work as they are, but it lets
me put the HTML in a physically different file.
I hope this makes sense.
Thanks in advance.
Kind regards
Dave
PS: Having just written this, I then tried to open one of my PHP files in
dreamweaver and what do you know, it opens and of course handles the PHP.
Still I still think the question is valid and maybe I will be told it is not
a good idea to use Dreamweaver to manage code with PHP in it.
Comment