Goodday, I am having trouble including css and js files in a PHP file.
Whenever I want to include a js file, the containing script element contains the whole html output.
Same goes for any included stylesheets.
It might be a output problem, but i really dont know what to edit to fix this.
Here is the code,
/* Output*/
$html = '<!DOCTYPE html>';
$html .= '<html>';
$html .= '<head>';
$html .= '<title>'.SITE_TITLE.'</title>';
$html .= '<script type="text/javascript">var HLINK = "'.SITE_URL.'/";</script>';
$html .= '<script type="text/javascript" src="public/js/core.js"></script>';
$html .= '<link rel="stylesheet" type="text/css" href="public/css/screen.css" />';
$html .= '</head>';
$html .= '<body>';
$html .= '<section id="wrap">';
switch ($pageurl[0]){
default : $post = require_once ('pages/homepage.php'); break;
}
$html .= '<div class="block">';
$html .= 'Doe het<br>';
$html .= '</div>';
$html .= '<pre>';
$html .= $post['post_id'];
$html .= $post['post_title'];
$html .= $post['post_subject'];
$html .= '</pre>';
$html .= '</section>';
$html .= '</body>';
$html .= '</html>';
echo $html;
This might be stupid, but i cant figure it out. I appreciate any help.
This is what the browser outputs:
<script src="public/js/core.js" type="text/javascript">
<!DOCTYPE html><html><head><title>BLOG</title><script type="text/javascript">var HLINK = "localhost/Ronanversendaal_Dev/";</script><script type="text/javascript" src="public/js/core.js"></script><link rel="stylesheet" type="text/css" href="public/css/screen.css" /></head><body><section id="wrap"><div class="block">mawfacking doe het<br></div><pre>1Eerste PostTestondwerp</pre></section></body></html>
</script>
How do I get it to output just the intended html?