Hi,
I am new to OOP and i am really confused about something in ZF program.
File -----Indexcontroller.php------
Code:
public $myNamespace;
public function websession()
{
$this->myNamespace = new Zend_Session_Namespace('Default');
if(isset($this->myNamespace->countPages))
{
$this->myNamespace->countPages++;
}
else
{
$this->myNamespace->countPages=1;
}
return $this->myNamespace->countPages;
}
public function indexAction()
{
/*$this->view->title = "Our Albums";
$this->view->headTitle($this->view->title, 'PREPEND');
$albums = new Model_DbTable_Albums();
$this->view->albums = $albums->fetchAll();*/
$this->view->message=$this->websession();
}
File-----index.phtml------
Code:
<h1>Message: <?php echo $this->message; ?></h1>
Above code display the refresh button pressed for a session. It is working fine. However, I have a few question regarding OOP.
File -----Indexcontroller.php------
1. I have tried
$this->view->message=$this->myNamespace->countPages;
but it looks like message variable is not storing it. It is not dipslaying it on webpage.
2. Why are we using $this->view->message instead of just $this->message? What is view?
File-----index.phtml------
3. <h1>Message: <?php echo $this->message; ?>
Why are we not using $this->view->message ?
We have stored the output of session in $this->view->message on indexController page but we are using only $this->message on index.phtml.
4.what is $this->escape($this->message); escape function in zend framework?
Please don't mind if i have asked stupid questions. I am new to OOP and ZF.
Thank You,
Umair