私は自分自身にZend amを教えています。私のセッションを使ってView Helperアクションを呼び出す際に問題があります。Zend Sessions問題(初心者)
マイコントローラ:
<?php
class SessionController extends Zend_Controller_Action
{
protected $session;
public function init() //Like a constructor
{
$this->_helper->viewRenderer->setNoRender(); // Will not automatically go to views/Session
$this->_helper->getHelper('layout')->disableLayout(); // Will not load the layout
}
public function preDispatch() //Invokes code before rendering. Good for sessions/cookies etc.
{
$this->session = new Zend_Session_Namespace(); //Create session
if(!$this->session->__isset('view'))
{
$this->session->view = $this->view; //if the session doesn't exist, make it's view default
}
}
public function printthingAction()
{
echo $this->session->view->tabbedbox($this->getRequest()->getParam('textme'));
}
}
?>
マイビューヘルパー
<?php
class App_View_Helper_Tabbedbox extends Zend_View_Helper_Abstract
{
public $wordsauce = "";
public function tabbedbox($message = "")
{
$this->wordsauce .= $message;
return '<p>' . $this->wordsauce . "</p>";
}
}
?>
マイビュー:私はtheButtonをクリック
<p>I GOT TO THE INDEX VIEW</p>
<input id='textme' type='input'/>
<input id='theButton' type='submit'/>
<div id="putstuffin"></div>
<script type="text/javascript">
$(function()
{
$("#theButton").click(function()
{
$.post(
"session/printthing",
{'textme' : $("#textme").val()},
function(response)
{
$("#putstuffin").append(response);
});
});
});
</script>
初めて、それが動作し、同様に私の言葉を追加それはそうなっている。
警告:call_user_func_array()[function.call-ユーザーFUNC-配列]:まず引数が有効なコールバックであることが予想され、「__PHP_Incomplete_Class ::後のすべての時間のために、しかし、それは私に、このエラーメッセージを表示しますtabbedbox 'は、C:¥xampp¥htdocs¥BC¥library¥Zend¥View¥Abstract.phpの341行に表示されます。
Zendcasts.comのビデオをほとんどの行にコピーしましたが、まだ動作しません。私のセッションが破壊されているようです。私は何が起こっているか教えてくれる人には永遠に感謝しています。
それです!ありがとうございました。 – Ethan