954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Zend Framework

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??

farhan.foxtrot
Newbie Poster
21 posts since Aug 2008
Reputation Points: 10
Solved Threads: 2
 

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

Hello World! A random number is : <?php echo  $this->randomNumber; ?>
farhan.foxtrot
Newbie Poster
21 posts since Aug 2008
Reputation Points: 10
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You