View Single Post
  #1 (permalink)  
Old 07-04-2008, 09:41 PM
otmtoy otmtoy is offline
Junior Member
 
Join Date: Jul 2008
Posts: 2
Post Controller variable not showing up in View

Hi, I just started playing with the Zend Framework and was trying out a sample in the demo video. I am using the std. tree structure for Controllers, Views and Models. I have an IndexController.php in which I have the following lines under indexAction function:

srand();
$this->view->randomNumber = rand(0,10);

I have a index.phtml under the Views/Scripts/index folder but the random variable is not showing up in the View:
I have the following lines in index.phtml:
<h1>Hello world! </h1>
<?=$this->randomNumber?>
The hello world shows up correctly but the random number does not. Any help is appreciated!
Thanks
Reply With Quote