Пример #1
0
<? require_once("classes/Recipe.php"); ?>
<? require_once("classes/Text.php"); ?>
<link href="steps.css" rel="stylesheet" type="text/css" />
<?

$id = $_REQUEST['id'];
if ($id == "") {
    $all = Recipe::getAll();
} else {
    $r = Recipe::getById($id);
    if ($r == NULL) {
        $errMsg = Text::getText("RecipeNotFound");
        include("error.php");
        exit;
    }
    $all = array(Recipe::getById($id));
}

// Expression to highlight
$hl = $_REQUEST['hl'];

?>
<? include("header.php"); ?>
<h2><?php 
echo Text::getText("View");
?>
</h2>

<? foreach ($all as $r) { ?>

<p>
Пример #2
0
<? require_once("classes/Recipe.php"); ?>
<? require_once("classes/Text.php"); ?>
<?
    $cat = $_POST['cat'];
    if (strlen($cat) == 0) {
        $recipes = Recipe::getAll();
    } else {
        if ($cat == "null") {
            $c = NULL;
        } else {
            $c = Category::getById($cat);
            if ($c == NULL) {
                $errMsg = Text::getText("CategoryNotFound").": ".$cat;
                include("error.php");
                exit;
            }
        }
        $recipes = Recipe::getInCategory($c);
    }
    
    $categories = Category::getAll();
    $catForId = array();
    foreach ($categories as $tempCat) {
        $catForId[$tempCat->getId()] = $tempCat;
    }
    
    foreach ($recipes as $r) {
        $fieldName = "cat".$r->getId();
        $newCatId = $_POST[$fieldName];
        //print "recipe ".$r->getId().": $newCatId<br>";
        if ($newCatId == "") {