0

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

1
  • are you sure layout.php is being included (maybe wrong path, or something..)? try replacing include 'layout.php'; by echo "<script>alert('x');</script>"; and see if it works Commented Nov 8, 2010 at 14:52

2 Answers 2

7

"text/javscript" -> "text/javascript"

Sign up to request clarification or add additional context in comments.

1 Comment

Another alternative is to not enter the language at all. The W3C are the only people who would ever care.
2

Works for me, you had text/javascript spelled wrong though.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.