当前位置: 首页>>代码示例>>PHP>>正文


PHP Recipe::getInCategory方法代码示例

本文整理汇总了PHP中Recipe::getInCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP Recipe::getInCategory方法的具体用法?PHP Recipe::getInCategory怎么用?PHP Recipe::getInCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Recipe的用法示例。


在下文中一共展示了Recipe::getInCategory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: include

<?
    $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 == "") {
            
        } else {
开发者ID:elecnix,项目名称:smellyfish,代码行数:31,代码来源:editAll.php

示例2: require_once

<? require_once("classes/Recipe.php"); ?>
<? require_once("classes/Category.php"); ?>
<? require_once("classes/Text.php"); ?>
<?
    $c = NULL;
    $cat = $_REQUEST['cat'];
    if (strlen($cat) == 0) {
        //$all = Recipe::getAll();
        $all = Recipe::getInCategory(NULL);
    } else {
        if ($cat == "null") {
            $all = Recipe::getInCategory(NULL);
        } else {
            $c = Category::getById($cat);
            $all = Recipe::getInCategory($c);
        }
    }

    include("header.php");
    if ($cat == "") {
        // Include only on the very front page
        include("welcome.php");
    }
    include("recipeNav.php");
    $rssUrl = $baseUrl."/rss.php?cat=".(strlen($cat) == 0 ? "null" : $cat);
?>

<? if ($c != NULL) { ?>
<h2><?php 
echo $c->getName();
?>
开发者ID:elecnix,项目名称:smellyfish,代码行数:31,代码来源:list.php

示例3: include

     include("error.php");
     exit;
 } else {
     if ($action == "delete") {
         if (strlen($newCat) > 0) {
             if ($newCat == NULL || $newCat == "null") {
                 $newCategory = NULL;
             } else {
                 $newCategory = Category::getById($newCat);
                 if ($newCategory == NULL) {
                     $errMsg = Text::getText("CategoryNotFound");
                     include("error.php");
                     exit;
                 }
             }
             $recipesToMove = Recipe::getInCategory($thisCat);
             for ($i = 0; $i < count($recipesToMove); $i++) {
                 $r2m = $recipesToMove[$i];
                 $r2m->setCategory($newCategory);
                 $r2m->save();
             }
         }
         $thisCat->delete();
         header("Location: categoryList.php");
     } else {
         $c = $thisCat;
         include("header.php");
         include("categoryDeleteForm.php");
         include("footer.php");
     }
 }
开发者ID:elecnix,项目名称:smellyfish,代码行数:31,代码来源:categoryDelete.php


注:本文中的Recipe::getInCategory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。