Hi, I am a beginner for the zend framework. I have viewed the screencast from the zend site and followed them. The summary of the screencasts are:

application
         controllers
                  IndexController.php
         models
         views
                 scripts
                       index
                             index.phtml
library
         Zend
public
         .htaccess
         index.php

The codes are following:

index.php:

<?php

//error reporting
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');

//modify include path to include path to library
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../library');

//zend framework includes
require_once 'Zend/Loader.php';

Zend_Loader::registerAutoload();

//get the front controller
$front = Zend_Controller_Front::getInstance();
$front->addControllerDirectory('../application/controllers');
$front->throwExceptions(true);

//run
$front->dispatch();

the IndexController.php is:

<?php
    
class IndexController extends Zend_Controller_Action{

    public function indexAction(){

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

the index.phtml is:

Hello World! A random number is : <?=$this->randomNumber?>

now the problem is for the url
http://localhost/Screencast/public/

the browser displays:

Hello World! A random number is : randomNumber?>

How can I show the number here. I have faced similer trouble with some other sample projects. Is it any configuration problem??

I've figured it out....
At the index.phtml the code will be

Hello World! A random number is : <?php echo  $this->randomNumber; ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.