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


PHP Blog::add方法代码示例

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


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

示例1: blog_handler

 function blog_handler()
 {
     $this->check_login();
     $params = $this->input->post();
     if (isset($params['save'])) {
         Blog::add($params);
     }
     redirect('admin/blogs');
 }
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:9,代码来源:admin.php

示例2: add

 public function add()
 {
     //モデルを呼び出す
     $blog = new Blog();
     $this->addOptions = $blog->add();
     //アクション名を指定
     $this->action = 'add';
     //ビューを呼び出す
     require 'views/layout/application.php';
 }
开发者ID:k-nish,项目名称:seed_blog,代码行数:10,代码来源:blogs_controller.php

示例3: create

 public function create($query)
 {
     $params = array('message' => null);
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $blog = new Blog();
         $blog->setFields($_POST);
         if ($blog->add()) {
             $params['message'] = 'Record added successfully';
         } else {
             $params['message'] = 'Request was not successfull. Please try again';
             $params['error'] = true;
         }
     }
     $this->setParams('params', $params);
     $this->render();
 }
开发者ID:awahid101,项目名称:Mist,代码行数:16,代码来源:BlogController.php

示例4: array

         } else {
             send_to_notify("error", 19);
         }
     }
     break;
 case "add_article":
 case "mod_article":
     //data
     $data = array("head" => $_POST["head"], "subh" => $_POST["subh"], "body" => $_POST["body"]);
     //meta-data
     $allow_comments = $_POST["allow_comments"] == "on" ? 1 : 0;
     $published = $_POST["published"] == "on" ? 1 : 0;
     $meta_data = array("tags" => $_POST["tags"], "author" => $_POST["author"], "allow_comments" => $allow_comments, "published" => $published);
     $blog = new Blog();
     if ($_GET["action"] == "add_article") {
         $id = $blog->add($data);
         if ($id) {
             $add_meta = $blog->add_meta($id, $meta_data);
         }
         //send ->
         if ($add_meta) {
             if ($GLOBALS["enable_logging"] == true) {
                 add_to_log($_SESSION["admin_user"], "Created Article {$head}");
             }
             send_to_notify("success", 2);
         } else {
             send_to_notify("error", 20);
         }
     } else {
         if ($_GET["action"] == "mod_article") {
             $id = $_GET["id"];
开发者ID:BGCX261,项目名称:zombiecms-svn-to-git,代码行数:31,代码来源:engine.php

示例5: testsperengine


//.........这里部分代码省略.........
    SmartTest::instance()->testPack = "unassociate by deleting a bean?";
    $anotherdrink = RedBean_OODB::dispense("whisky");
    $anotherdrink->name = "bowmore";
    $anotherdrink->age = 18;
    $anotherdrink->singlemalt = 'y';
    RedBean_OODB::set($anotherdrink);
    RedBean_OODB::associate($anotherdrink, $john);
    $hisdrinks = RedBean_OODB::getAssoc($john, "whisky");
    if (count($hisdrinks) !== 1) {
        SmartTest::failedTest();
    }
    RedBean_OODB::trash($anotherdrink);
    $hisdrinks = RedBean_OODB::getAssoc($john, "whisky");
    if (count($hisdrinks) !== 0) {
        SmartTest::failedTest();
    }
    SmartTest::instance()->progress();
    SmartTest::instance()->testPack = "create parent child relationships?";
    $pete = RedBean_OODB::dispense("person");
    $pete->age = 48;
    $pete->gender = "m";
    $pete->name = "Pete";
    $peteid = RedBean_OODB::set($pete);
    $rob = RedBean_OODB::dispense("person");
    $rob->age = 19;
    $rob->name = "Rob";
    $rob->gender = "m";
    $saskia = RedBean_OODB::dispense("person");
    $saskia->age = 20;
    $saskia->name = "Saskia";
    $saskia->gender = "f";
    RedBean_OODB::set($saskia);
    RedBean_OODB::set($rob);
    RedBean_OODB::addChild($pete, $rob);
    RedBean_OODB::addChild($pete, $saskia);
    $children = RedBean_OODB::getChildren($pete);
    $names = 0;
    if (is_array($children) && count($children) === 2) {
        foreach ($children as $child) {
            if ($child->name === "Rob") {
                $names++;
            }
            if ($child->name === "Saskia") {
                $names++;
            }
        }
    }
    if (!$names) {
        SmartTest::failedTest();
    }
    $daddies = RedBean_OODB::getParent($saskia);
    $daddy = array_pop($daddies);
    if ($daddy->name === "Pete") {
        $ok = 1;
    } else {
        $ok = 0;
    }
    if (!$ok) {
        SmartTest::failedTest();
    }
    SmartTest::instance()->progress();
    SmartTest::instance()->testPack = "remove a child from a parent-child tree?";
    RedBean_OODB::removeChild($daddy, $saskia);
    $children = RedBean_OODB::getChildren($pete);
    $ok = 0;
    if (count($children) === 1) {
开发者ID:seanhess,项目名称:redbean,代码行数:67,代码来源:test.php

示例6: Blog

 }
 SmartTest::instance()->canwe = "countRelated";
 R::gen("Blog,Comment");
 $blog = new Blog();
 $blog2 = new Blog();
 $blog->setTitle("blog1");
 $blog2->setTitle("blog2");
 for ($i = 0; $i < 5; $i++) {
     $comment = new Comment();
     $comment->setText("comment no.  {$i} ");
     $blog->add($comment);
 }
 for ($i = 0; $i < 3; $i++) {
     $comment = new Comment();
     $comment->setText("comment no.  {$i} ");
     $blog2->add($comment);
 }
 if ($blog->numofComment() !== 5) {
     die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
 } else {
     SmartTest::instance()->progress();
 }
 if ($blog2->numofComment() !== 3) {
     die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
 } else {
     SmartTest::instance()->progress();
 }
 SmartTest::instance()->canwe = "associate tables of the same name";
 $blog = new Blog();
 $blogb = new Blog();
 $blog->title = 'blog a';
开发者ID:Jamongkad,项目名称:Sunfish,代码行数:31,代码来源:test.php


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