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


PHP ArticleModel::save方法代码示例

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


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

示例1: AddAction

 protected function AddAction()
 {
     $article = new ArticleModel();
     $article->title = $_POST['title'];
     $article->content = $_POST['content'];
     $article->save();
     $view = new View();
     $view->display('add.php');
 }
开发者ID:vera23,项目名称:Articles,代码行数:9,代码来源:NewsController.php

示例2: invoke

  function invoke($request)
  {
    //save
    global $_SESSION, $config;
    session_start();
    if(isset($request["password"]) and $request["password"]===$config["password"] )
    {
      $_SESSION["password"] = $request["password"];
    }
    if(isset($request["save"]) and $_SESSION["password"]===$config["password"])
    {
      ArticleModel::save($request);
    }

    $view = new HtmlView($request);
    $view->put();
  }
开发者ID:nishantjr,项目名称:JUgly,代码行数:17,代码来源:Base.php

示例3: update

 public function update()
 {
     if (!IS_POST) {
         $this->message2('非法操作!', __APP__ . '/Admin');
     }
     $id = I('id', NULL);
     if (!empty($id)) {
         $article = new ArticleModel();
         if ($data = $article->create()) {
             if (false !== $article->save()) {
                 $this->message('编辑成功', __URL__ . '/index');
             } else {
                 $this->message('编辑失败:' . $article->getError(), __URL__ . '/index');
             }
         } else {
             $this->message('编辑失败:' . $article->getError(), __URL__ . '/index');
         }
     } else {
         $this->message('请选择编辑对象', __URL__ . '/index');
     }
 }
开发者ID:kwdwkiss,项目名称:kongbao8,代码行数:21,代码来源:ArticleAction.class.php

示例4: SaveSubjectAction

 public function SaveSubjectAction()
 {
     $request = Project::getRequest();
     $article_model = new ArticleModel();
     if (count($article_model->loadByParentId(0, array(ARTICLE_COMPETITION_STATUS::NEW_ARTICLE), Project::getUser()->getDbUser()->id)) < 5) {
         $article_model->title = $request->title;
         $article_model->articles_tree_id = $request->parent_id;
         $article_model->user_id = Project::getUser()->getDbUser()->id;
         $article_model->rate_status = ARTICLE_COMPETITION_STATUS::NEW_ARTICLE;
         $article_model->creation_date = date("Y-m-d H:i:s");
         $article_model->save();
     }
     Project::getResponse()->redirect($request->createUrl('Article', 'CompetitionCatalog'));
 }
开发者ID:amanai,项目名称:next24,代码行数:14,代码来源:ArticleController.php

示例5: update

 /**
  * 文章编辑更新页面
  */
 function update()
 {
     $article = new ArticleModel();
     if (!!($data = $article->create())) {
         if (!empty($data['id'])) {
             if (false !== $article->save()) {
                 $this->assign('jumpUrl', __URL__ . '/index');
                 $this->success('更新成功');
             } else {
                 $this->error('更新失败:' . $article->getDbError());
             }
         } else {
             $this->error('请选择编辑用户');
         }
     } else {
         $this->error('更新失败:( ' . $article->getError() . ' )');
     }
 }
开发者ID:omusico,项目名称:AndyCMS,代码行数:21,代码来源:ArticleAction.class.php

示例6: SaveArticleAction

 public function SaveArticleAction()
 {
     $request = Project::getRequest();
     $id = (int) $request->id;
     $article_model = new ArticleModel();
     $article_page_model = new ArticlePageModel();
     $article_model->load($id);
     $article_model->user_id = Project::getUser()->getDbUser()->id;
     $article_model->articles_tree_id = $request->article_cat;
     $article_model->title = $request->article_title;
     $article_model->allowcomments = (bool) $request->allow_comment;
     $article_model->rate_status = (bool) $request->allow_rate;
     $article_model->creation_date = date("Y-m-d H:i:s");
     $id = $article_model->save();
     for ($i = 0; $i < count($request->title_page); $i++) {
         $article_page_model = new ArticlePageModel();
         $article_page_model->load($request->id_page[$i]);
         $article_page_model->article_id = $id;
         $article_page_model->title = $request->title_page[$i];
         $article_page_model->p_text = $request->content_page[$i];
         $article_page_model->save();
     }
     $data = array();
     $this->_makeArticleList($data);
     $this->_view->AjaxArticleList($data);
     $this->_view->ajax();
 }
开发者ID:amanai,项目名称:next24,代码行数:27,代码来源:AdminArticleController.php


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