Authored by ziy

调整了一下Action ,加入了Css和JS的push

... ... @@ -8,9 +8,9 @@ use Yaf;
class Action extends Controller_Abstract
{
private $_headlink;
private $_viewLink = array();
private $_headscript;
private $_viewScript = array();
private $_headTitle;
... ... @@ -22,7 +22,7 @@ class Action extends Controller_Abstract
/**
* Meta
* @return Q_View_Header_Meta
* @return \Hood\Helper\View\Meta
*/
public function _headMeta()
{
... ... @@ -33,35 +33,36 @@ class Action extends Controller_Abstract
return $this->_headmeta;
}
/**
* Script
* @return Q_View_Header_Script
* @return \Hood\Helper\View\Script
*/
public function _headScript()
public function _viewScript($scriptName = '_headScript')
{
if (empty($this->_headscript)) {
$this->_headscript = new hoodView\Script();
$this->getView()->assign("_headScript", $this->_headscript);
if (!isset($this->_viewScript[$scriptName])) {
$this->_viewScript[$scriptName] = new hoodView\Script();
$this->getView()->assign($scriptName, $this->_viewScript[$scriptName]);
}
return $this->_headscript;
return $this->_viewScript[$scriptName];
}
/**
*
* @return Q_View_Header_Link
* @return \Hood\Helper\View\Link
*/
public function _headLink()
public function _viewLink($linkName = '_headLink')
{
if (empty($this->_headlink)) {
$this->_headlink = new hoodView\Link();
$this->getView()->assign("_headLink", $this->_headlink);
if (!isset($this->_viewLink[$linkName])) {
$this->_viewLink[$linkName] = new hoodView\Link();
$this->getView()->assign($linkName, $this->_viewLink[$linkName]);
}
return $this->_headlink;
return $this->_viewLink[$linkName];
}
/**
* Title
* @return Q_View_Header_Title
* @return \Hood\Helper\View\Title
*/
public function _headTitle($title = null)
{
... ... @@ -124,7 +125,7 @@ class Action extends Controller_Abstract
protected function helpJsonResult($code, $message = null, $data = null)
{
header('Content-type: application/json');
echo json_encode(array('code'=>$code, 'message'=>$message, 'data'=>$data));
echo json_encode(array('code' => $code, 'message' => $message, 'data' => $data));
exit();
}
... ... @@ -153,7 +154,7 @@ class Action extends Controller_Abstract
{
header('Content-type: application/json');
echo $callbackString . "(";
echo json_encode(array('code'=>$code, 'message'=>$message, 'data'=>$data));
echo json_encode(array('code' => $code, 'message' => $message, 'data' => $data));
echo ")";
exit();
}
... ...