javascriptcursus/playground.php
<?php
// Includes:
require_once 'php/page.php';
// Page:
$page = new page("Playground");
$page->addHeader('<script type="text/javascript" src="js/playground.js"></script>');
$page->addContent('<p>Op deze pagina kun je wat JavaScript, HTML en CSS uitproberen. Type de code in het bovenstaande vak en klik vervolgens op <i>Laat zien</i> om het resultaat in het onderste vak te bekijken.</p>');
$code='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl">
<head>
<title>Playground code preview</title>
<script type="text/javascript">
</script>
<style type="text/css">
</style>
</head>
<body>
</body>
</html>';
if(isset($_POST['code']))
$code = $_POST['code'];
$page->addContent($page->createWhiteBlock(
'<b>Code:</b><br /><textarea id="pre-code" name="pre-code">'.htmlentities($code).'</textarea><br /><br />'.
'<form method="post" id="code-form" target="preview-frame" action="playground-preview.php">'.
'<input type="checkbox" name="open-new-tab" id="open-new-tab" /> <label for="open-new-tab">Open de code in een nieuw tabblad</label><br /><br />'.
'<input type="submit" value="Laat zien" /> <input type="reset" value="Reset code" />'.
'<input type="hidden" id="code" name="code" value="" />'.
'</form>'));
$page->addContent('<br />');
$page->addContent($page->createWhiteBlock('<b>Resultaat:</b><br /><iframe src="playground-preview.php" id="preview-frame" name="preview-frame" width="100%" height="300"></iframe>'));
$page->printAll();
?>
Resultaat
Made by Thijs Aarnoudse