开发者

Better way of mixing up own framework with PHP zend framework

开发者 https://www.devze.com 2023-01-30 06:42 出处:网络
Recently I\'ve started to use Zend framework next to my own framework. The solution at this moment for instance for the module "partner" having a rewrite condition in htaccess like

Recently I've started to use Zend framework next to my own framework. The solution at this moment for instance for the module "partner" having a rewrite condition in htaccess like

RewriteCond %{REQUEST_URI} ^./partner/?(.)

//redirect to build ZF

RewriteRule ^.*$ public/partner/index.php

// and the bootstrap files are

//index.开发者_如何学运维php for Zend set_include_path(APPLICATION_PATH . '../../../library/php/');

include_once 'Zend/Loader/Autoloader.php';

//index.php for own framework set_include_path(get_include_path() . PATH_SEPARATOR . 'library/php/');

Is it possible to use Zend components just like it would with PEAR components?

Or the question with different perspective

Am I required to choose one of the two MVC patterns to go along with?

At the end I want to be able to use any library/framework for any module.


You can use ZF components similar to PEAR stuff. The only thing you will need to do is set the include path so, that ZF's requires will function:

set_include_path('path/to/library' . PATH_SEPARATOR . get_include_path())

where path/to/library contains the Zend directory.

At this point you can either initialize the ZF autoloader, or use require_once to load any classes you want to use.

0

精彩评论

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