Пример #1
0
<html>
<body>
<?php 
function addheader($page, $title)
{
    $page .= "<html><head><title>" . $title . "</title></head><body><h1 align=\"center\">";
    $page .= $title . '</h1>';
    return $page;
}
function addfooter($page, $year, $copyright)
{
    $page .= "<div align=\"center\">&copy;" . $year . " " . $copyright . "</div></body></html>";
    return $page;
}
$page = "";
$page = addheader($page, 'a procedural script');
echo $page;
$page .= "<p align=\"center\">this page with generated with procedural script</p>";
$page = addfooter($page, date('Y'), 'procedural dsigns Inc');
echo $page;
?>
</body>
</html>
Пример #2
0
    $twists = str_replace($shape, "", $twists);
    $FIGArray = '["' . $saltos . '","' . $twists . '","' . $shape . '"]';
    echo '["' . $skill['level'] . '","' . $skill['skill'] . '","' . $skill['shaped'] . '","' . $skill['shape_bonus'] . '","' . lcfirst($skill['start_position']) . '","' . lcfirst($skill['end_position']) . '","' . $skill['tariff'] . '",' . $FIGArray . '],
		';
}
echo '["empty_skill"] ]';
// Last element of js array must not end with a ,
// Correctly orders level by difficulty vs alphabetic
$routineSpecialSQL = "SELECT * FROM tariff_routines\n\t\tWHERE level IN ('Novice','Intermediate','Intervanced','Advanced','Elite')\n\t\tORDER BY CASE level \n\t\t\tWHEN 'Novice' THEN 1\n\t\t\tWHEN 'Intermediate' THEN 2\n\t\t\tWHEN 'Intervanced' THEN 3\n\t\t\tWHEN 'Advanced' THEN 4\n\t\t\tWHEN 'Elite' THEN 5\n       END";
$routines_query = mysqli_query($db, $routineSpecialSQL);
// Open Javascript 2D array. First element all blanks so when option 0 is selected all boxes are cleared
echo "\n\n\t\t var routines = [\n\t\t\t[\"\",\"\",\"\",\"\",\"\",\"\",\"\",[\"\",\"\",\"\"]],";
while ($rout = mysqli_fetch_array($routines_query)) {
    if ($rout['show'] == '1') {
        echo '["' . $rout['level'] . '","' . $rout['comp'] . '","' . $rout['name'] . '",';
        for ($i = 1; $i < 10; $i++) {
            echo '"' . $rout['skill' . $i] . '",';
        }
        echo '"' . $rout['skill10'] . '"],
			';
    }
}
echo '["empty_routine"] ]';
// Last element of js array must not end with a ,
?>
    </script>
    <script src="js/tariff_calc.js"></script>

<?php 
addfooter();