function generateSample($test_name, $base_url, $_example_xrds = null, $filename = null) { global $example_xrds, $default_test_file; if ($_example_xrds === null) { $_example_xrds = $example_xrds; } if ($filename === null) { $filename = $default_test_file; } $template = getData($filename, $test_name); if ($template === null) { return null; } return fillTemplate($test_name, $template, $base_url, $_example_xrds); }
<?php require_once 'func_template.php'; $bindings = array(); $template = ''; if (array_key_exists('name', $_GET)) { $template = 'thankyou.template'; $bindings['NAME'] = $_GET['name']; } else { $template = 'user.template'; } $bindings['DESTINATION'] = $_SERVER['PHP_SELF']; echo fillTemplate($template, $bindings);
$data["pages"] .= $i . " "; } else { $data["pages"] .= '<a href="' . $_CONFIG["urlroot"] . 'issues/' . $i . '">' . $i . "</a> "; } } echo fillTemplate(file_get_contents("templates/issues.html"), $data); break; case "issue": $notfound = false; if ($_GET["issueid"]) { $issueid = $_GET["issueid"]; $gameroot = $_CONFIG["pathtapes"] . $issueid . "/"; $gamefile = $gameroot . "tape.json"; if (is_file($gamefile)) { $loadeddata = json_decode(file_get_contents($gamefile), true); foreach ($data as $key => $value) { $loadeddata[$key] = $value; } $loadeddata["gameroot"] = $gameroot; $loadeddata["issueid"] = $issueid; echo fillTemplate(file_get_contents("templates/issue.html"), $loadeddata); } else { $notfound = true; } } break; } } if ($notfound) { echo fillTemplate(file_get_contents("templates/home.html"), $data); }