本文整理汇总了PHP中NewsModel::findOneByPk方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsModel::findOneByPk方法的具体用法?PHP NewsModel::findOneByPk怎么用?PHP NewsModel::findOneByPk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsModel
的用法示例。
在下文中一共展示了NewsModel::findOneByPk方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionOne
public function actionOne()
{
$id = $_GET['id'];
$news = NewsModel::findOneByPk($id);
$view = new View();
$view->items = $news;
$view->display('one.php');
}
示例2: actionOne
public function actionOne()
{
$id = $_GET['id'];
$item = NewsModel::findOneByPk($id);
if (empty($item)) {
throw new E404Exception('Нет такой новости');
}
$view = new View();
$view->item = $item;
$view->display('news/one.php');
}
示例3: actionOne
public function actionOne()
{
$id = $_GET['id'];
$item = NewsModel::findOneByPk($id);
if (!empty($item)) {
$view = new View();
$view->item = $item;
$view->display('news/one.php');
} else {
$e_message = 'Page not found: Пустой результат выборки';
$e_code = 1.1;
throw new E404Exception($e_message, $e_code);
}
}
示例4: actionDelNews
public function actionDelNews()
{
$news = new NewsModel();
$view = new View();
if (isset($_GET['id'])) {
$item = NewsModel::findOneByPk($_GET['id']);
$view->item = $item;
$view->deleted = true;
//$news->delete();
} else {
$newsTitles = NewsModel::findAll();
$view->news = $newsTitles;
}
$view->display('admin/delnews.php');
}
示例5: actionEdit
public function actionEdit()
{
$news = new NewsModel();
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$news->id = $_POST['id'];
$news->title = $_POST['title'];
$news->text = $_POST['text'];
$news->save();
header("Location: /index.php?ctrl=Admin&act=All");
}
$id = $_GET['id'];
$items = $news->findOneByPk($id);
$view = new View();
$view->item = $items;
$view->display('news/newsedit.php');
}