Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Sessions Problem (beginner)
    primarykey
    data
    text
    <p>I'm teaching myself Zend am and having a problem with using my session to call a View Helper action. </p> <p>My controller: </p> <pre><code>&lt;?php class SessionController extends Zend_Controller_Action { protected $session; public function init() //Like a constructor { $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender(); // Will not automatically go to views/Session $this-&gt;_helper-&gt;getHelper('layout')-&gt;disableLayout(); // Will not load the layout } public function preDispatch() //Invokes code before rendering. Good for sessions/cookies etc. { $this-&gt;session = new Zend_Session_Namespace(); //Create session if(!$this-&gt;session-&gt;__isset('view')) { $this-&gt;session-&gt;view = $this-&gt;view; //if the session doesn't exist, make it's view default } } public function printthingAction() { echo $this-&gt;session-&gt;view-&gt;tabbedbox($this-&gt;getRequest()-&gt;getParam('textme')); } } ?&gt; </code></pre> <p>My view helper</p> <pre><code>&lt;?php class App_View_Helper_Tabbedbox extends Zend_View_Helper_Abstract { public $wordsauce = ""; public function tabbedbox($message = "") { $this-&gt;wordsauce .= $message; return '&lt;p&gt;' . $this-&gt;wordsauce . "&lt;/p&gt;"; } } ?&gt; </code></pre> <p>My view:</p> <pre><code>&lt;p&gt;I GOT TO THE INDEX VIEW&lt;/p&gt; &lt;input id='textme' type='input'/&gt; &lt;input id='theButton' type='submit'/&gt; &lt;div id="putstuffin"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; $(function() { $("#theButton").click(function() { $.post( "session/printthing", {'textme' : $("#textme").val()}, function(response) { $("#putstuffin").append(response); }); }); }); &lt;/script&gt; </code></pre> <p>The first time I click on theButton, it works, and appends my word like it's supposed to. For every time after, though, it gives me this error message:</p> <p><strong>Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '__PHP_Incomplete_Class::tabbedbox' was given in C:\xampp\htdocs\BC\library\Zend\View\Abstract.php on line 341</strong></p> <p>I copied the Zendcasts.com video almost line for line, and it's still not working. It seems like my session is getting destroyed or something. I would be forever grateful to anyone who could tell me what's happening.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload