Reputation: 41
I want to nest a entry pop script into header, the whole code looks like -
<script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
$(document).ready(function()
{
alert(\'Warning!\n\nClick OK to proceed.\');
});
</script>
And I need to nest that into the following code, in between the single quotes -
$snippet_b[1] = '';
How am I supposed to place the code?
Thanks a bunch for your help!
Upvotes: 1
Views: 97
Reputation: 46900
So? Why not just do it. Your quotes are already escaped
<?php
$snippet_b[1] ='
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
alert(\'Warning!\n\nClick OK to proceed.\');
});
</script>
';
echo $snippet_b[1];
?>
Upvotes: 3
Reputation: 1878
easiest way is to use the heredoc notation
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
$snippet_b[1] = <<<SNIPPET_B1
your code here, all quotes OK.
SNIPPET_B1;
Upvotes: 2