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

Luke Girvin
13.5k10 gold badges69 silver badges87 bronze badges
asked Nov 8, 2010 at 14:47
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"

answered Nov 8, 2010 at 14:53
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.

answered Nov 8, 2010 at 14:56

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.