Ejemplo n.º 1
0
 public function addtocms($cid, $title, $content)
 {
     $db = Das_CmsDb::factory();
     $db->query("set names utf8");
     $dq = $db->fetchOne("select domain from v9_site where siteid = 1");
     $domain = $dq;
     $fdata = array('catid' => $cid, 'typeid' => 0, 'title' => $title, 'listorder' => 0, 'status' => 99, 'sysadd' => 1, 'islink' => 0, 'inputtime' => time());
     $db->beginTransaction();
     try {
         $db->insert('v9_xzgk', $fdata);
         $lastid = $db->lastInsertId();
         $mdata = array('id' => $lastid, 'content' => $content);
         $db->insert('v9_xzgk_data', $mdata);
         $up_data = array('url' => $dq . "index.php?m=content&c=index&a=show&catid={$cid}&id={$lastid}");
         $where = array('id' => $lastid);
         $db->update('v9_xzgk', $up_data, $where);
         $db->commit();
     } catch (Exception $e) {
         $db->rollBack();
         echo "<pre>";
         var_dump($e);
         die;
         return;
     }
 }
Ejemplo n.º 2
0
 public function getchildcatAction()
 {
     $cid = $_GET['cid'];
     // $this->getHelper ('layout')->disableLayout ();
     // print_r($this->getHelper ('layout'));
     $cid = '1440';
     $cmsdb = Das_CmsDb::factory();
     $cmsdb->query("set names utf8");
     $ret = $cmsdb->query("select * from v9_category where siteid=1 and parentid=" . $cid . " order by  parentid,catid")->fetchAll();
     header('Content-Type: application/json');
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     echo Zend_Json_Encoder::encode($ret);
     exit;
 }