Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-04-2008, 09:41 PM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-05-2008, 01:29 AM
Junior Member
 
Join Date: Jul 2008
Posts: 2
Default Issue with short tags

I just figured out what the problem was. The sample is using short tags which are disabled by default on the windows PHP install. Once I used the long form things worked fine:

<?php echo $this->randomNumber; ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:33 PM.