开发者

confusion of View Helpers

开发者 https://www.devze.com 2023-02-03 18:56 出处:网络
I\'m on shared hosting where www only accessible by web server , so I change the structure recommended for the project based ZenFramework putting the library under the folder www :

I'm on shared hosting where www only accessible by web server , so I change the structure recommended for the project based ZenFramework putting the library under the folder www :

www/

index.php

application/

Modules/

front/

admin/

Library/

the .htaccess :

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.php [NC,L]

I tested locally under WampServer, everything works fine.

when I go online, I get errors on View Helpers :

Warning: include_once(): Unable to access /home/www/application/Modules/front/views/helpers/HeadMeta.php

there is confusion between ZendFramework views helpers and the view helpers that I create myself. and when I copy the content 开发者_JAVA百科: library \ Zend \ View \ Helper \ to \ application \ modules \ front \ views \ helpers everything works fine ! and it is the same concern for module admin/ I do not understand how why. is what I have to keep the View helpers with my aides custom view ?

Thank you in advance for your answers.

Update:

I have not attached and any help create by myself . but I have to create action helpers, like this:

resources.frontController.moduleDirectory = APPLICATION_PATH "/Modules"
resources.frontController.defaultModule ="front"
resources.frontController.actionHelperPaths.Application_front_Controller_Helper = APPLICATION_PATH "/Modules/front/controllers/helpers/"
resources.modules[]=

Bootstrap module :

class front_Bootstrap extends Zend_Application_Module_Bootstrap

{
    public function _initHelper()

    {

        $this->bootstrap('frontController');

        $navigation = Zend_Controller_Action_HelperBroker::getStaticHelper('NavigationPath');   

        Zend_Controller_Action_HelperBroker::addHelper($navigation);

    }
}


Several thoughts/questions/comments:

  1. It sure seems to be looking for the view helper within your Module folder. Are you attempting to call a custom HeadMeta helper developed by you, or are you are attempting to call the standard Zend_View_Helper_HeadMeta helper? Have you set any helper paths in either Bootstrap or application/config.ini?

  2. Your current setup has a security issue: What if someone requests the url: http://exmaple.com/application/config.ini? I don't see any protection there. Note that you don't necessarily have to move all your ZF folders up in to the document root. Rather, you could push them down and place deny-all protection on that folder. See: Zend Framework on shared hosting. That blog post offers other approaches to ZF on shared hosting, as well.

  3. Finally, when something works on Windows but doesn't work on Linux, there are several usual suspects to check.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号