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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-19-2008, 12:39 PM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default Zend Front Contoller

Hi All

I am new to the Zend framework and I am writing a simple helloworld script and I am getting the following error which I can't work out

Fatal error: Cannot access protected property Zend_Controller_Front::$_instance in /usr/share/php/Zend/library/Zend/Controller/Front.php on line 165

What does this mean?

Code snippet of index controller
PHP Code:
<?php

    Zend_loader
::loadClass('Zend_Controller_Action');
    class 
IndexController extends Zend_Controller_Action {
        public function 
indexAction() {
            echo 
"<center><h1>Hello World</h1></center>";
        }
    }
?>

Thanks in advance

Danny
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-20-2008, 07:39 PM
Senior Member
 
Join Date: Jun 2008
Location: Florida
Posts: 108
Default

Show us your bootstrap, I dont think that error is coming from that controller.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-26-2008, 10:55 AM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default Zend error

Hi here is my bootstrap file, sorry for the delay

PHP Code:
<?php
    ini_set 
("display_errors"1);
    
error_reporting(E_ALL);
    
$lib_paths = array();
    
$lib_paths[] = "/var/www/rewardcentre/application";
    
$lib_paths[] = "/usr/share/php/Zend/library/";
    
$inc_path implode(PATH_SEPARATOR$lib_paths);
    
set_include_path($inc_path);

    require_once 
'Zend/Loader.php';
    require_once 
'Zend/Controller/Front.php';

    try {
        
Zend_Loader::loadClass('Zend_Controller_Front');
        
$frontController Zend_Controller_Front::getInstance();
        
$frontController->throwExceptions(true);
        
$frontController->setParam('noViewRendered'true);
        
$frontController->setParam('noErrorHandler'true);
        
$frontController->setControllerDirectory('/var/www/rewardcentre/application/controllers/');
        
$frontController->dispatch();
    }
    catch (
Exception $exp) {
        
$contentType 'text/html';
        
header("Content-Type: $contentType; charset=utf-8");
        echo 
'an unexpected error occured';
        echo 
'<h2>Unexpected Exception: ' $exp->getMessage() . '</h2><br /><pre>';
        echo 
$exp->getTraceAsString();;
    }
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-26-2008, 04:11 PM
Senior Member
 
Join Date: Jun 2008
Location: Florida
Posts: 108
Default

Which version of PHP and which version of ZF are you using?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-28-2008, 02:52 AM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default

hi

I am using PHP Version 5.2.0-8+etch4 and latest version of zend framework

Danny
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-08-2008, 07:05 AM
Junior Member
 
Join Date: Oct 2008
Posts: 1
Smile Seems like a Typo in Text

This seems to be an old post but I thought I will respond since it may be useful to someone else.

I don't know why your error is occurring.. However I found a typo:
It seems like you are following the example given in PHP Architect's Guide to Programming with Zend. Unfortunately that book have a gazillion typos. For no view rendering (that is the case since you did not create the index.phtml) you have to set param:
$frontController->setParam('noViewRenderer', true);

The following is wrong - the Front Controller is trying to render the non-existant view.
$frontController->setParam('noViewRendered', true);

Fixing this may not help you but you can try.
Hope this helps.
Hari Gangadharan

Last edited by harinair : 10-08-2008 at 07:13 AM.
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 12:42 PM.