GGshow reloaded GGshow reloaded

February 3, 2012

Duplicated placeholder output

Issue:

  • Zend Framework placeholder (headTitle, headMeta, headLink, headScript, headStyle, inlineScript) creates twice or multiple title/meta/link/script tags in HTML.
  • Duplicated title/meta/link/script tags generated from Zend Framework placeholder.
  • e.g.:

    source:

    <?php echo $this->headScript()->appendFile("/scripts/global.js") ?>
    <?php echo $this->headScript()->appendFile("/scripts/main.js") ?>

    output:

    <script src="/scripts/global.js" type="text/javascript"></script>
    <script src="/scripts/global.js" type="text/javascript"></script>
    <script src="/scripts/main.js" type="text/javascript"></script>

Reason:

  • Echo will output all elements in a placeholder.

Solution:

  • Echo only once for each placeholder.
  • e.g.:
    <?php $this->headLink()->appendStylesheet('/styles/global.css') ?>
    <?php $this->headLink()->appendStylesheet('/styles/main.css') ?>
    <?php echo $this->headLink() ?>
    
    <?php $this->headScript()->appendFile("/scripts/global.js") ?>
    <?php $this->headScript()->appendFile("/scripts/main.js") ?>
    <?php echo $this->headScript() ?>
Filed under: CSS,JavaScript,PHP,Web,Zend Framework — Tags: , , — GG @ 11:15 am

Resource matching “view” not found

Issue:

  • [error]
    [client 127.0.0.1] 
    PHP Fatal error:  Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "view" not found' in /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php:694
    Stack trace:
    #0 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(629): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('view')
    #1 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('view')
    #2 /home/user/ZendFramework-1.11.11/bin/jquery/application/Bootstrap.php(7): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('view')
    #3 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initDoctype()
    #4 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('doctype')
    #5 /home/user/ZendFramework-1.11.11/library/Zend/Appli in /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php on line 694

Reason:

  • Resource matching “view” not found.

Solution:

  • Add the following line to application.ini
    resources.view[] =
Filed under: PHP,Web,Zend Framework — Tags: , , — GG @ 11:02 am

© 2024 GGSHOW | Powered by WordPress