put include in the body
I have in any page in the head an include to php page. in that php there are some sql and some divs.
my problem is that because of the divs, all my layout is damaged.(it's automatically put t开发者_JAVA百科he divs before the wrapper div). if i put the include in the body- everything is ok. (because i put it after the <div id=wrapper>
)
so i have 2 questions:
1.is it the same to put the include in the body and in the head?
2.if not, how can i put the divs after the wrapper's div?
thank you!
1.is it the same to put the include in the body and in the head?
It depends on what the include file contains. In your case, since it contains some html code, it is not good idea to include it in <head>
tag, you need to place it below <body>
tag.
2.if not, how can i put the divs after the wrapper's div?
You need to include your file exactly where you want to make something to appear.
You could investigate using Output Buffering.
That way, you can capture the output that your included script creates, then decide where to output it.
ob_start() ;
include "path/to/script.php" ;
$out = ob_get_contents() ;
ob_end_clean() ;
echo "<div id=\"wrapper\">" ;
echo $out ;
echo "</div>" ;
精彩评论