IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Zend Framework PHP Discussion :

Zend Framework Quickstart Application - PHP non interprété


Sujet :

Zend Framework PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut [Resolu] Zend Framework Quickstart Application - PHP non interprété
    Je suis en train de me mettre a ZF... j'ai donc commencé par la ZF Quickstart Application. (cf http://framework.zend.com/docs/quickstart)

    Seul probleme, il semble que le code PHP de mon layout ne soit pas interprete, j'obtiens ainsi l'affichage suivant
    (eg http://bioinfo.csu.edu.cn/test/Zendf/public/)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    doctype() ?>  headLink()->appendStylesheet('/css/global.css') ?>
    ZF Quickstart Application
    Guestbook
    layout()->content ?>
    Quelqu'un a t'il une idee ?

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut
    A noter que j'utilise EasyPHP sans settings particulier et la derniere version de ZF.

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    98
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 98
    Points : 93
    Points
    93
    Par défaut
    Pourrais-tu nous montrer le contenu de ton bootstrap.php et de ton layout.phtml. On aurait plus d'info pour t'aider

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut
    Tout est ici

    http://framework.zend.com/demos/Zend...t-20080915.zip

    bootstrap.php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    <?php
    // application/bootstrap.php
    //
    // Step 1: APPLICATION CONSTANTS - Set the constants to use in this application.
    // These constants are accessible throughout the application, even in ini
    // files. We optionally set APPLICATION_PATH here in case our entry point
    // isn't index.php (e.g., if required from our test suite or a script).
    defined('APPLICATION_PATH')
        or define('APPLICATION_PATH', dirname(__FILE__));
     
    defined('APPLICATION_ENVIRONMENT')
        or define('APPLICATION_ENVIRONMENT', 'development');
     
    // Step 2: FRONT CONTROLLER - Get the front controller.
    // The Zend_Front_Controller class implements the Singleton pattern, which is a
    // design pattern used to ensure there is only one instance of
    // Zend_Front_Controller created on each request.
    $frontController = Zend_Controller_Front::getInstance();
     
    // Step 3: CONTROLLER DIRECTORY SETUP - Point the front controller to your action
    // controller directory.
    $frontController->setControllerDirectory(APPLICATION_PATH . '/controllers');
     
    // Step 4: APPLICATION ENVIRONMENT - Set the current environment.
    // Set a variable in the front controller indicating the current environment --
    // commonly one of development, staging, testing, production, but wholly
    // dependent on your organization's and/or site's needs.
    $frontController->setParam('env', APPLICATION_ENVIRONMENT);
     
    // LAYOUT SETUP - Setup the layout component
    // The Zend_Layout component implements a composite (or two-step-view) pattern
    // With this call we are telling the component where to find the layouts scripts.
    Zend_Layout::startMvc(APPLICATION_PATH . '/layouts/scripts');
     
    // VIEW SETUP - Initialize properties of the view object
    // The Zend_View component is used for rendering views. Here, we grab a "global"
    // view instance from the layout object, and specify the doctype we wish to
    // use. In this case, XHTML1 Strict.
    $view = Zend_Layout::getMvcInstance()->getView();
    $view->doctype('XHTML1_STRICT');
     
    // CLEANUP - remove items from global scope
    // This will clear all our local boostrap variables from the global scope of
    // this script (and any scripts that called bootstrap). This will enforce
    // object retrieval through the applications's registry.
    unset($view);
     
    // Step 5: CLEANUP - Remove items from global scope.
    // This will clear all our local boostrap variables from the global scope of
    // this script (and any scripts that called bootstrap).  This will enforce
    // object retrieval through the applications's registry.
    unset($frontController);
    layout.phtml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    <? /* application/layouts/scripts/layout.phtml
    
          This line outputs the doctype we set in the bootstrap */ ?>
    <?= $this->doctype() ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Zend Framework Quickstart Application</title>
      <?= $this->headLink()->appendStylesheet('/css/global.css') ?>
    </head>
    <body>
     
    <!--
        Layouts are a great place to put header and footer content that will be
        needed on all pages that share the same layout.  To understand fully what
        having layouts inside a MVC application mean, check out the Zend_Layout
        section of the manual.
        http://framework.zend.com/manual/en/zend.layout.html
        -->
    <div id="header" style="background-color: #EEEEEE; height: 30px;">
        <div id="header-logo" style="float: left">
            <b>ZF Quickstart Application</b>
        </div>
        <div id="header-navigation" style="float: right">
            <!-- To keep urls consistent with the applications router (right now we
                 are using the default router), we will employ the use of the url
                 view helper
                 http://framework.zend.com/manual/en/zend.view.helpers.html
                 -->
            <a href="<?= $this->url(
                array('controller'=>'guestbook'),
                'default',
                true) ?>">Guestbook</a>
        </div>
    </div>
     
    <!-- This next call will now include any content that was generated in the
         dispatching of a controllers action (or series of actions).  -->
     
    <?= $this->layout()->content ?>
     
    <!-- If your application requires it, this would be a great place to put a
         footer for all pages. -->
     
    </body>
    </html>

  5. #5
    Membre expert
    Avatar de Eusebe
    Inscrit en
    Mars 2006
    Messages
    1 992
    Détails du profil
    Informations personnelles :
    Âge : 46

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 992
    Points : 3 344
    Points
    3 344
    Par défaut
    Est-ce que tu as bien la dernière version du framework ?

    Si ce n'est pas le cas, il me semble que certaines versions nécessitaient d'activer les short_open_tags pour les utiliser dans les vues.

  6. #6
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut
    Citation Envoyé par Eusebe Voir le message
    Est-ce que tu as bien la dernière version du framework ?
    Oui le fichier telecharge est le ZendFramework-1.7.1-minimal.zip

    Citation Envoyé par Eusebe Voir le message
    Si ce n'est pas le cas, il me semble que certaines versions nécessitaient d'activer les short_open_tags pour les utiliser dans les vues.
    Non ce n'est pas ca, j'ai activé ca dans le php.ini

    En plus j'ai le meme comportement pour le code suivant sans les short tags :S

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    <?php /* application/layouts/scripts/layout.phtml
    
          This line outputs the doctype we set in the bootstrap */ ?>
    <?php= $this->doctype() ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Zend Framework Quickstart Application</title>
      <?php= $this->headLink()->appendStylesheet('/css/global.css') ?>
    </head>
    <body>
     
    <!--
        Layouts are a great place to put header and footer content that will be
        needed on all pages that share the same layout.  To understand fully what
        having layouts inside a MVC application mean, check out the Zend_Layout
        section of the manual.
        http://framework.zend.com/manual/en/zend.layout.html
        -->
    <div id="header" style="background-color: #EEEEEE; height: 30px;">
        <div id="header-logo" style="float: left">
            <b>ZF Quickstart Application</b>
        </div>
        <div id="header-navigation" style="float: right">
            <!-- To keep urls consistent with the applications router (right now we
                 are using the default router), we will employ the use of the url
                 view helper
                 http://framework.zend.com/manual/en/zend.view.helpers.html
                 -->
            <a href="<?= $this->url(
                array('controller'=>'guestbook'),
                'default',
                true) ?>">Guestbook</a>
        </div>
    </div>
     
    <!-- This next call will now include any content that was generated in the
         dispatching of a controllers action (or series of actions).  -->
     
    <?php= $this->layout()->content ?>
     
    <!-- If your application requires it, this would be a great place to put a
         footer for all pages. -->
     
    </body>
    </html>

  7. #7
    Membre expert
    Avatar de Eusebe
    Inscrit en
    Mars 2006
    Messages
    1 992
    Détails du profil
    Informations personnelles :
    Âge : 46

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 992
    Points : 3 344
    Points
    3 344
    Par défaut
    Bizarre, ton exemple de fichier layout.phtml ne correspond pas à ce qui est affiché sur ton site (ni au fichier de la version actuelle du Quickstart, qui lui ressemble bien à celui de ton site).

    bref, est-tu bien sûr de modifier les fichiers au bon endroit, ou confonds-tu deux installations du Quickstart ?

  8. #8
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut
    Citation Envoyé par Eusebe Voir le message
    Bizarre, ton exemple de fichier layout.phtml ne correspond pas à ce qui est affiché sur ton site (ni au fichier de la version actuelle du Quickstart, qui lui ressemble bien à celui de ton site).
    Euh ce n'est pas mon site, ce que j'obtiens sur mon PC est identique a ce qui est affiche sur le site en question.
    Mais j'utilise le layout du tutoriel.

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut
    AU passage c'est clairement un probleme de configuration Apache ou PHP car cela marche parfaitement sur mon site OVH.

  10. #10
    Membre régulier
    Profil pro
    Inscrit en
    Août 2008
    Messages
    74
    Détails du profil
    Informations personnelles :
    Âge : 48
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Août 2008
    Messages : 74
    Points : 82
    Points
    82
    Par défaut
    J'ai modifie tous les parametres PHP d'EasyPHP de maniere a mapper exactement ceux d'OVH... et ca marche.
    Maintenant je n'ai aucune idee de ce que c'etait.

Discussions similaires

  1. Accéder à un fichier PHP non interprété
    Par nabab dans le forum Langage
    Réponses: 1
    Dernier message: 21/07/2008, 14h16
  2. Installation Apache et PHP 5 : PHP non interprété
    Par Corben dans le forum Apache
    Réponses: 12
    Dernier message: 16/06/2008, 17h49
  3. [phpBB] Code PHP non interprété dans un thème subsilver
    Par killpilot dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 2
    Dernier message: 24/06/2007, 11h42
  4. [Tableaux] [débutant] scripts PHP non interprétés
    Par alexbigot dans le forum Langage
    Réponses: 5
    Dernier message: 06/12/2006, 15h03
  5. index.php non interprété directement
    Par Celeborn dans le forum Apache
    Réponses: 3
    Dernier message: 04/07/2006, 14h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo