I am working with PHP includes i.e:
include_once("somephpfile.php");
And a CSS/HTML designer that is very problematic. I am trying to keep all PHP away from the designer, as they become very panicked : \ and they create many problems, deleting code and things and messing up everything.
So I have been using the PHP includes to add the PHP where necessary between their HTML.
The PHP works fine and there are zero bugs.
It is the separation of the PHP into multiple include files that is causing my some problems.
Following is an example of what I am trying to separate.
The PHP to be separated:
<?php
$foo = 0;
$bar = 0;
if($foo == 0){
$foo++;
$bar++;
// more php code
while($foo < 20){
$foo++;
$bar++;
// more php code
// Now write the designers HTML here in this loop
?>
<BR /> Some HTML
<?php echo $foo; ?>
more html
<?php echo $bar; ?>
<BR /> More HTML <BR /> <BR />
<?php
// Done with the designers code -Now close my PHP here
}// END while($foo < 5)
}// END if($foo == 0)
?>
I want to separate this into 2 includes - include1.php and include2.php
And I want to have the designers code between the while loop. So what I did was this:
include1.php
if($foo == 0){
$foo++;
$bar++;
// more php code
while($foo < 20){
$foo++;
$bar++;
// more php code
?>
DESIGNERS HTML and a little mixed PHP
<BR /> Some HTML
<?php echo $foo; ?>
more html
<?php echo $bar; ?>
<BR /> More HTML <BR /> <BR />
include2.php
<?php
// Done with the designers code -Now close my PHP here
}// END while($foo < 5)
}// END if($foo == 0)
?>
I get an error ("Parse error: syntax error, unexpected $end in)
I have multiple if's and while's and loops.
My question is: How do I separate these braces / brackets without an error?
Thank you