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


PHP Recipe::findByKeyword方法代码示例

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


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

示例1: Recipe

$recipes = new Recipe();
$new_recepies = new Recipe();
$order = 0;
// Keeps track of the asc, desc order.
// using the Recipe model, retrieve an array of recipes
$recipes = Recipe::findAll($dbh);
// get querystring data (part 2)
if ($_GET) {
    if (array_key_exists('sort', $_GET)) {
        // Explode the value and get the name of the column to be sorted, and the $order it should sort it.
        $arr = explode('_', $_GET['sort']);
        $column = $arr[0];
        $order = $arr[1];
        $recipes = Recipe::findAll($dbh, $column, $order);
        if ($order == 0) {
            $order = 1;
        } else {
            $order = 0;
        }
    }
}
// get form data (part 3)
if ($_POST) {
    // Get the string from $_POST, and search for that string in the database.
    if (array_key_exists("terms", $_POST)) {
        $keyWord = $_POST["terms"];
        $recipes = Recipe::findByKeyword($dbh, $keyWord);
    }
}
// require the view
require_once "views/view_recipes.php";
开发者ID:elifah93,项目名称:Internet-Programming,代码行数:31,代码来源:RecipeList.php

示例2:

    }
}
//Determining whether the field is Name, Prep Time, Total Time, and Rating
if (isset($_GET['field'])) {
    if ($_GET['field'] == 'Name') {
        $fieldName = "Name";
    } else {
        if ($_GET['field'] == 'Prep') {
            $fieldName = "Prep";
        } else {
            if ($_GET['field'] == 'Total') {
                $fieldName = "Total";
            } else {
                if ($_GET['field'] == 'Rating') {
                    $fieldName = "Rating";
                }
            }
        }
    }
}
// get form data (part 3)
//If user clicks button, this happens
if ($_POST) {
    $searching = $_POST["terms"];
    $recipes = Recipe::findByKeyword($dbh, $searching, true);
    require_once "views/view_recipes.php";
} else {
    $recipes = Recipe::findAll($dbh, $sortingTitle, $fieldName, true);
    // require the view
    require_once "views/view_recipes.php";
}
开发者ID:bolivarez9193,项目名称:Brandons_Repo,代码行数:31,代码来源:RecipeList.php

示例3:

require_once "models/Ingredient.php";
require_once "models/units_of_measure.php";
// get querystring data (part 2)
$recipe = Recipe::findAll($dbh);
$newRecipe;
if (isset($_GET['Details'])) {
    $viewID = $_GET['Details'];
    require_once "ShowRecipe.php";
    $newRecipe = 0;
    die;
} else {
    if (isset($_GET['order'])) {
        $recipe = Recipe::sortBy($dbh, $_GET['order']);
    } else {
        if (isset($_GET['addRecipe'])) {
            //$ing = Ingredient::sortIngredientASC($dbh);
            //$units = units_of_measure::sortUnitsASC($dbh);
            $ing = Ingredient::findAll($dbh);
            $units = units_of_measure::findAll($dbh);
            $newRecipe = 1;
            require_once "EditRecipe.php";
            die;
        }
    }
}
if ($_POST) {
    if (array_key_exists('terms', $_POST)) {
        $recipe = Recipe::findByKeyword($dbh, $_POST['terms']);
    }
}
require_once "views/view_recipes.php";
开发者ID:xavidram,项目名称:RecipeListPHP,代码行数:31,代码来源:RecipeList.php


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