我们是否可以将代码池设置在“外部”;代码“;Magento中的目录

我们是否可以将代码池设置在“外部”;代码“;Magento中的目录,magento,magento-1.7,Magento,Magento 1.7,我们可以在Magento中的“Code”目录之外提供代码池吗 define('DS', DIRECTORY_SEPARATOR); define('PS', PATH_SEPARATOR); define('BP', dirname(dirname(__FILE__))); Mage::register('original_include_path', get_include_path()); //echo get_include_path(); //die('This is inclu

我们可以在Magento中的“Code”目录之外提供代码池吗

define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('BP', dirname(dirname(__FILE__)));

Mage::register('original_include_path', get_include_path());

//echo get_include_path(); 

//die('This is included path');

if (defined('COMPILER_INCLUDE_PATH')) {
    $appPath = COMPILER_INCLUDE_PATH;
    set_include_path($appPath . PS . Mage::registry('original_include_path'));
    include_once COMPILER_INCLUDE_PATH . DS . "Mage_Core_functions.php";
    include_once COMPILER_INCLUDE_PATH . DS . "Varien_Autoload.php";
} else {
    /**
     * Set include path
     */

    $paths[] = BP . DS . 'app' . DS . 'custom' . DS . 'custom'; 

   /* 'custom' is My own folder name present out side the code directory */

    $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local'; 
    $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
    $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
    $paths[] = BP . DS . 'lib';

    $appPath = implode(PS, $paths);
    set_include_path($appPath . PS . Mage::registry('original_include_path'));
    include_once "Mage/Core/functions.php";
    include_once "Varien/Autoload.php";
}

这对我不起作用。是否有任何方法可以将代码池放在magento的“Code”目录之外。

您可以通过在app/Mage.php的下面一行中放置代码池来获得自定义代码池

$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'custom';
我希望你已经知道了

但是如果你想让你的代码池保持在app/custom中,那么为你的代码池创建符号链接将是最简单的方法。感染您可以将代码池放置在系统中的任何位置

这就是创建符号链接的方式(考虑到
/home/deependra/public\u html
是您的magento根目录)


我不得不问,为什么要创建自定义代码池?它有什么好处?这3个代码池已经涵盖了基本内容,添加一个自定义代码池会使事情变得过于复杂。如果选择升级,还需要对每个版本的Magento进行黑客攻击,这也会让熟悉标准化代码池的开发人员感到困惑。您正在编写针对您自己的扩展?使用本地代码池,这就是它的用途。亲爱的Axel,我想问你为什么magento会给出代码池的路径,比如$path[]=BP。D应用程序'。D代码'。D本地",;而不是$path[]=BP。DS‘代码’。D本地",;这意味着您可以在“app”目录中的任何位置创建自己的代码池,而这在我的情况下不起作用。我知道3个代码池涵盖了所有重要部分,即使我们不需要创建自定义代码池。但是为什么magento为这样的代码池提供了路径呢。有没有办法在代码目录之外创建一个代码池,我只想在“code”目录@axel之外创建一个代码池你在修改一个核心文件,Magento没有给你任何东西。您只找到了Magento定义代码池的地方。我只是想让你知道,创建你自己的不是一个推荐的方法,而且很可能是你今后遇到问题的原因。它使事情变得过于复杂,违反了Magento的代码标准。
ln -s /home/deependra/public_html/app/custom/custom/ /home/deependra/public_html/app/code/custom