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


PHP article::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $article = new article();
     $article->title = Input::get('title');
     $article->short_description = Input::get('short_description');
     $article->image = Input::get('image');
     $article->description = Input::get('description');
     $article->category_id = Input::GET('category_id');
     $article->save();
     return View::make('pages.Admin.Article.alert')->with('pesan', $article->title . ' Saved');
 }
开发者ID:asykar-ma,项目名称:ayam_kalasan,代码行数:16,代码来源:ArticleController.php

示例2: actionAddarc

 /**
  *  添加文章
  */
 public function actionAddarc()
 {
     if ($_POST) {
         $article = new article();
         $article->title = $_POST['titles'];
         $article->article = $_POST['Html'];
         $article->cataId = $_POST['cata'];
         $article->remark = substr(strip_tags($_POST['info']), 0, 150);
         $article->time = date('Y-m-d H:i:s', time());
         $article->creater = Yii::app()->session['USER_ACCOUNT']['id'];
         $article->save(false);
         if ($AID = $article->attributes['id']) {
             foreach ($_POST['Tags'] as $key => $value) {
                 CActiveRecord::$db->createCommand()->insert('tagsasarticle', array('articleId' => $AID, 'tagsId' => $value, 'time' => date('Y-m-d H:i:s', time())));
             }
             exit('文章发表成功!');
         }
     }
     /**
      * 查询出分类列表
      */
     $Sql = 'SELECT * FROM `catalog`';
     $QueryRow = CActiveRecord::$db->createCommand($Sql)->queryAll();
     $QueryRow = $this->SelectdOrder($QueryRow, 0, 0);
     $this->ArrayToObject($QueryRow);
     /**
      * 查询出tags标签信息
      */
     $Sql = 'Select * from `tags` limit 0,8';
     $Tags = CACtiveRecord::$db->createCommand($Sql)->queryAll();
     $this->ArrayToObject($Tags);
     $this->render('insert', array('SelectAll' => $QueryRow, 'tagsbox' => $Tags));
 }
开发者ID:xuyi5918,项目名称:ipensoft,代码行数:36,代码来源:MainController.php

示例3: article

 /**
  * Cnews::recycle()
  * 
  * @param integer $id
  * @param mixed $value
  * @return
  */
 function isolate_recycle($id = 0, $value)
 {
     if ($id != 0) {
         $news = new article($id);
         if (!$news->exists()) {
             show_404();
         }
         $news->recycle = ($news->recycle + 1) % 2;
         $news->save();
         $news->unset_home();
         if ($news->recycle == 1) {
             flash_message('success', "Xóa thành công.");
         } else {
             flash_message('success', "Phục hồi thành công.");
         }
     } else {
         $arr = $this->input->post('checkinput');
         foreach ($arr as $row) {
             $news = new article($row);
             $id = $news->id;
             $news->recycle = $value;
             $news->save();
             $news->unset_home();
             $news->clear();
         }
         if ($value == 1) {
             flash_message('success', "Xóa thành công.");
         } else {
             flash_message('success', "Phục hồi thành công.");
         }
     }
     $n = new Article($id);
     $newscatalogue = $n->newscatalogue;
     $this->session->set_userdata(array(config_item('session_admin') . 'menu_current' => $newscatalogue->navigation));
     if (empty($newscatalogue->menu_active)) {
         $dis['menu_active'] = "Tin";
     } else {
         $dis['menu_active'] = $newscatalogue->menu_active;
     }
     redirect($this->admin . "cnews/isolate_list_by_cat/" . $newscatalogue->id);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:48,代码来源:cnews.php

示例4: article

 function up_position_home()
 {
     $max = new article();
     $max->select_max('home_hot_position');
     $max->where('home_hot_position <', $this->home_hot_position);
     $max->where('home_hot', 1);
     $max->get();
     $o = new article();
     $o->where('home_hot_position', $max->home_hot_position);
     $o->where('home_hot', 1);
     $o->get();
     if ($o->result_count() > 0) {
         $tg = $this->home_hot_position;
         $this->home_hot_position = $o->home_hot_position;
         $o->home_hot_position = $tg;
         $o->save();
         $this->save();
         $this->arrange_position_home();
         return true;
     } else {
         return false;
     }
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:23,代码来源:article.php


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