コード例 #1
0
ファイル: class.jsonpage.php プロジェクト: valery/symphony-2
 /**
  * The generate functions outputs the correct headers for
  * this `JSONPage`, adds `$this->getHttpStatusCode()` code to the root attribute
  * before calling the parent generate function and generating
  * the `$this->_Result` json string
  *
  * @param null $page
  * @return string
  */
 public function generate($page = null)
 {
     // Set the actual status code in the xml response
     $this->_Result['status'] = $this->getHttpStatusCode();
     parent::generate($page);
     return json_encode($this->_Result);
 }
コード例 #2
0
 /**
  * The generate functions outputs the correct headers for
  * this `XMLPage`, adds `$this->getHttpStatusCode()` code to the root attribute
  * before calling the parent generate function and generating
  * the `$this->_Result` XMLElement
  *
  * @param null $page
  * @return string
  */
 public function generate($page = null)
 {
     // Set the actual status code in the xml response
     $this->_Result->setAttribute('status', $this->getHttpStatusCode());
     parent::generate($page);
     return $this->_Result->generate(true);
 }