i have this in my index.php
include 'app/Core.php';
echo Core::getPageHtml();
in Core.php
final class Core
{
public static function getPageHtml()
{
ob_start();
include 'layout.php';
$html = ob_get_clean();
return $html;
}
}
layout.php is normal html code, i can see de page, just perfect, but the javascript code doesn't work, i even write an alert('hello world'), like this
<script type="text/javscript">
alert('hello world');
</script>
so, it should be simple, but i can make it work, what am i missing here? need some help with this code
Luke Girvin
13.5k10 gold badges69 silver badges87 bronze badges
asked Nov 8, 2010 at 14:47
Kstro21
7,84114 gold badges65 silver badges97 bronze badges
2 Answers 2
"text/javscript" -> "text/javascript"
answered Nov 8, 2010 at 14:53
Eric Mickelsen
10.4k2 gold badges33 silver badges41 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
JAL
Another alternative is to not enter the language at all. The W3C are the only people who would ever care.
Works for me, you had text/javascript spelled wrong though.
answered Nov 8, 2010 at 14:56
John Giotta
17.1k7 gold badges55 silver badges83 bronze badges
Comments
lang-php
layout.phpis being included (maybe wrong path, or something..)? try replacinginclude 'layout.php';byecho "<script>alert('x');</script>";and see if it works