本文整理汇总了PHP中Recipe::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Recipe::getById方法的具体用法?PHP Recipe::getById怎么用?PHP Recipe::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Recipe
的用法示例。
在下文中一共展示了Recipe::getById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRecipe
function getRecipe() {
if ($this->recipe == NULL && $this->recipe_id != NULL) {
$this->recipe = Recipe::getById($this->recipe_id);
}
return $this->recipe;
}
示例2: require_once
<? 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>
示例3: require_once
<? require_once("classes/Recipe.php"); ?>
<? require_once("classes/Text.php"); ?>
<?
$id = $_REQUEST['id'];
if (strlen($id) == 0) {
$title = Text::getText("Edit");
$errMsg = Text::getText("RecipeNotFound");
include("error.php");
} else {
$r = Recipe::getById($id);
$c = NULL;
$cat = $_REQUEST['cat'];
if (strlen($cat) > 0) {
$c = Category::getById($cat);
}
$action = $_REQUEST['action'];
if ($action == "save") {
$r->setTitle(StripSlashes($_REQUEST['title']));
$r->setCategory($c);
$r->setOrigin(StripSlashes($_REQUEST['origin']));
$r->setSize(StripSlashes($_REQUEST['size']));
$r->setIngredients(StripSlashes($_REQUEST['ingredients']));
$r->setSteps(StripSlashes($_REQUEST['steps']));
if ($_FILES['photo']['size'] != 0) {
$filename = $_FILES['photo']['name'];
$extension = strrchr($filename, '.');
$extension = strtolower($extension);
if ($extension != ".jpg") {
$r->save();
$errMsg = Text::getText("OnlyJpegFiles");
} else {