Sto seguendo la guida

http://php.html.it/guide/leggi/195/g...end-framework/

per iniziare ad utilizzare il framework.

Scusatemi innanzitutto se dico castronerie ma sono alle prime armi.

Seguendo la guida mi sono venuti molti dubbi, oltre a non funzionarmi alcune cose. Premetto che ho installato Zend Server su ambiente Windows.

1) Qui http://php.html.it/guide/lezione/483...end-framework/ specifica che è necessario attivare il rewriting. Perchè? E' fondamentale?

2) Qui http://php.html.it/guide/lezione/483...end-framework/ nel file application.ini ci sono molte voci che non ci sono nella creazione base fatta con zf create project tra i quali quelli relativi al frontController. Questi devono essere specificati per forza oppure funziona ugualmente?

3) Alla pagina http://php.html.it/guide/lezione/487...egli-utenti-i/ si va a creare il modello Utente; questo però estende Zend_Db_Table_Abstract; non dovrebbe estendere Zend_Db_Table come specificato qui http://php.html.it/guide/lezione/4855/il-model-zenddb/ ?

4) Ho completato una parte della guida creando Model, View e Controller per visualizzare la lista degli utenti come nelle pagine http://php.html.it/guide/lezione/487...egli-utenti-i/ ma quando richiamo la pagina http://localhost/public/utente/list che dovrebbe richiamare il metodo list del controller utente continua ad uscirmi la pagina 'Internal Server Error'; ho provato anche a mettere nelle variabili del server la visualizzazione degli errori ma il risultato è lo stesso

Ecco il listato:

application.ini
Codice PHP:
[production]
phpSettings.display_startup_errors 0
phpSettings
.display_errors 0
includePaths
.library APPLICATION_PATH "/../library"
bootstrap.path APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace "Application"
resources.frontController.controllerDirectory APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions 0


phpSettings
.date.timezone "Europe/Rome"

includePaths.zend APPLICATION_PATH "/../../library"

autoloadernamespaces.drin "Intranet"

resources.db.adapter PDO_MYSQL
resources
.db.params.host localhost
resources
.db.params.username root
resources
.db.params.password password
resources
.db.params.dbname test
resources
.db.isDefaultTableAdapter true

resources
.frontController.moduleDirectory APPLICATION_PATH "/modules"
resources.frontController.plugins.layout Intranet_Controller_Plugin_Layout

resources
.modules[] =

resources.layout.layoutPath APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = default
admin.resources.layout.layout admin
resources
.view.helperPath.App_View_Helper APPLICATION_PATH "/views/helpers"


[staging production]


[
testing production]
phpSettings.display_startup_errors 1
phpSettings
.display_errors 1


[development production]
phpSettings.display_startup_errors 1
phpSettings
.display_errors 1
resources
.frontController.params.displayExceptions 
Utente.php
Codice PHP:
<?php
// Per gestire ogni tabella è necessario creare il relativo MODEL
class Model_Utente extends Zend_Db_Table_Abstract {
    
    
// nome della tabella
    
protected $_name 'utenti';
    
    
// chiave primaria
    
protected $_primary 'userid';
    
    
    
// METODO: visualizzare la lista degli utenti registrati
    
public static function getUtenti() {
            
            
$select $this->select();
            
$select->from($this,array('username''lastname''firstname'))
                ->
order('lastname ASC');
            return 
$this->fetchAll($select);
    
    }
}
?>
UtenteController.php
Codice PHP:
<?php
class UtenteController extends Zend_Controller_Action
{

    public function 
init()
    {
        
/* Initialize action controller here */
    
}

    public function 
indexAction()
    {
        
// action body
    
}

    public function 
listAction()
    {
        
// Richiama sull'oggetto MODEL il METODO getUtenti() e salva il risultato nella variabile $utentiCorrenti
        
$utentiCorrenti Model_Utente::getUtenti();
        if (
$utentiCorrenti->count() > 0) {
          
$this->view->utenti $utentiCorrenti;
        } else {    
          
$this->view->utenti null;
        }    
    }
}
?>
list.phtml
Codice PHP:



<div id="view-content">
    
    

View script for controller [b]Utente[/b] and script/action name [b]list[/b]</p>
    
    <h3>Lista degli utenti</h3>
    
    <?php
        
//questa è proprio la variabile che abbiamo impostato nel controller
        
if( $this->utenti != null ) {
            echo 
"<ul class='data'>";
            foreach ( 
$this->utenti as $utente ) {
                echo 
"[*]" $utente->firstname;
                echo  
$utente->lastname " - " $utente->username;
                echo 
"";        
            }
            echo 
"</ul'>";   
    
?>
             
    <?php } else { ?>
     
            

La lista degli utenti attualmente risulta vuota.</p>
     
    <?php ?>

</div>
Però come detto non funziona.
L'errore che ho trovato nel log del server è questo:

Codice PHP:
[09-Sep-2011 16:46:38PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(C:\Programmi\Zend\Apache2\htdocs\Intranet\application/modules,C:\Programmi\Zend\Apache2\htdocs\Intranet\application/modules) [[url='directoryiterator.--construct']directoryiterator.--construct[/url]]: Impossibile trovare il file specificato. (code: 2)' in C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php:289
Stack trace
:
#0 C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php(289): DirectoryIterator->__construct('C:\Programmi\Ze...')
#1 C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Resource\Frontcontroller.php(72): Zend_Controller_Front->addModuleDirectory('C:\Programmi\Ze...')
#2 C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAbstract.php(681): Zend_Application_Resource_Frontcontroller->init()
#3 C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Boot in C:\Programmi\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php on line 292 
Grazie