本文整理匯總了PHP中ContentModel::Get_One_Content方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentModel::Get_One_Content方法的具體用法?PHP ContentModel::Get_One_Content怎麽用?PHP ContentModel::Get_One_Content使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ContentModel
的用法示例。
在下文中一共展示了ContentModel::Get_One_Content方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Get_Content
private function Get_Content()
{
global $templates;
$content = new ContentModel();
if (isset($_GET['id'])) {
$content->id = $_GET['id'];
if (!$content->Detail_Count()) {
Tool::alertBack('警告:閱讀量累計失敗');
}
$object = $content->Get_One_Content();
$templates->assgin('title_id', $object->id);
$templates->assgin('title_content', $object->title);
$templates->assgin('count', $object->read_count);
$templates->assgin('date', $object->date);
$templates->assgin('source', $object->source);
$templates->assgin('author', $object->author);
$templates->assgin('info', $object->info);
$templates->assgin('content', $object->content);
}
}
示例2: Action
public function Action()
{
global $templates;
switch ($_GET['action']) {
case 'show':
$templates->assgin('title', '文檔列表');
$templates->assgin('show', true);
$nav = new NavModel();
$id = $nav->Get_All_Childid();
foreach ($id as $value) {
$arr[] = $value->id;
}
$nav_id = implode(',', $arr);
$content = new ContentModel();
$content->nav = $nav_id;
$templates->assgin('Show_Content', $content->Get_Content());
//顯示所有的content
$this->Nav();
//顯示所有的導航,select標簽
if (isset($_GET['nav']) && $_GET['send'] == '刷選') {
//開始刷選
if ($_GET['nav'] != 0) {
//不為零
$content->nav = $_GET['nav'];
} else {
$content->nav = $nav_id;
//為零的話,默認全部
}
$templates->assgin('Show_Content', $content->Get_Content());
//顯示所有的content
}
break;
case 'update':
if ($_POST['send'] == '修改文檔') {
$this->model->id = $_POST['id'];
$this->Get_Post();
$this->model->Update_Content() ? Tool::alertLocation('文檔修改成功', 'content.php?action=show') : Tool::alertBack('文檔修改失敗');
}
$templates->assgin('title', '修改文檔');
$templates->assgin('update', true);
if (isset($_GET['id'])) {
$content = new ContentModel();
$content->id = $_GET['id'];
$object = $content->Get_One_Content();
if (!$object) {
Tool::alertBack('文檔不存在');
}
$templates->assgin('titlec', $object->title);
$this->attr($object->attr);
$this->Nav($object->nav);
$this->readlimit($object->read_limit);
$this->color($object->color);
$this->sort($object->sort);
$this->commend($object->commend);
$templates->assgin('id', $object->id);
$templates->assgin('tag', $object->tag);
$templates->assgin('keyword', $object->keyword);
$templates->assgin('thumbnail', $object->thumbnail);
$templates->assgin('source', $object->source);
$templates->assgin('author', $object->author);
$templates->assgin('info', $object->info);
$templates->assgin('content', $object->content);
$templates->assgin('read_count', $object->read_count);
$templates->assgin('gold', $object->gold);
$templates->assgin('color', $object->color);
} else {
Tool::alertBack('非法操作');
}
break;
case 'add':
if (isset($_POST['send'])) {
$this->Get_Post();
$affect = $this->model->Add_Content();
if ($affect == 1) {
Tool::alertLocation('添加文檔成功', '?action=show');
} else {
Tool::alertBack('警告:文檔添加失敗');
}
}
$templates->assgin('title', '新增文檔');
$templates->assgin('add', true);
$this->Nav();
break;
case 'delete':
if (isset($_GET['id'])) {
$this->model->id = $_GET['id'];
$this->model->Delete_Content() ? Tool::alertLocation('文檔刪除成功', 'content.php?action=show') : Tool::alertBack('文檔刪除失敗');
}
break;
default:
echo '非法操作';
break;
}
}