autoload

Magento trying to autoload class unnecessarily

六月ゝ 毕业季﹏ 提交于 2019-12-11 14:36:20
问题 I'm using a 3rd party php library to connect to Microsoft Dynamics CRM, which I've placed in the /lib folder of Magento. I've created a controller for testing purposes, in which I'm including the files from the lib folder (which are being included, as changing the paths throws an error), but when I try and initiate the class defined in one of the included files, i get this warning: Warning: include(DynamicsCRM2011\Connector.php) [function.include]: failed to open stream: No such file or

Codeigniter: Change autoload libraries for one controller?

别说谁变了你拦得住时间么 提交于 2019-12-11 11:03:28
问题 I've the following libs in the autoload.php : $autoload['libraries'] = array('database', 'session'); I need the session lib everywhere - besides of ONE controller, where it causes only trouble. Now the question is: Is there a possibility NOT to load the session lib for this special controller or is the only option to delete it from the autoload and add it to every single controller, where needed? 回答1: In your autoload.php: $autoload['libraries'] = array('database'); $CI =& get_instance(); if

How to register path in autoload using a single instance.

百般思念 提交于 2019-12-11 08:44:03
问题 Sorry about the vague title, but I am trying to find some better alternatives to having to call an Autoloader class, and the register method multiple times, to map class paths as seen below. $ClassLoader = new Autoloader\Loader(__DIR__.'/path/to/someclass'); $ClassLoader->register(); $ClassLoader = new Autoloader\Loader(_DIR__.'/path/to/anotherclass'); $ClassLoader->register(); $ClassLoader = new Autoloader\Loader(__DIR__.'/path/to/anotherclass'); $ClassLoader->register(); $ClassLoader = new

Load a class with a different name than the one passed to the autoloader as argument

巧了我就是萌 提交于 2019-12-11 05:29:56
问题 basically, I have the following problem: I want to make use of PHP's new namespace features. Unfortunately, I'm running a PHP version (5.3.2) in which namespace-autoload-support for linux still seems buggy and does not work (PHP should be able to load the class file automatically by its namespace without having to use a custom autoloader, but that doesn't work). What I want to achieve is to write an autoloader that I can simply remove as soon as the php's namespace features work correctly

Priority between spl_autoload_register and extension's function?

…衆ロ難τιáo~ 提交于 2019-12-11 03:37:07
问题 I use composer to manage my dependencies and class loading. This tool uses spl_autoload_register function. I would like to use a PHP's extension that provides some classes with same definition (name, namespacing, functionnalities) than others classes defined throught composer . Which class will PHP load? The extension's one, or the autoload's one, or maybe the PHP's comportment is undefined? 回答1: PHP will use the extension's one. This is because autoloading will only happen if you are

PHP Class Autoloading

一笑奈何 提交于 2019-12-10 21:47:55
问题 I have a "simple framework" whose main instance is $app. Now, what is the best way to implement an autoloader (without using Composer). What I need is to have a class which handles all the autoloading (supporting the various namespaces). I have a few approaches/dilemmas. At first I thought I should create a "static" class which handles everything. But then something came to my mind. If I use the autoloader before instantiating $app (which contains all the paths), I would need to define the

CodeIgniter - Autoload

只谈情不闲聊 提交于 2019-12-10 20:43:50
问题 I was wondering what the best practices for CodeIgniter's autoload are. Is it bad practice to just autoload everything I might ever need, or is it okay to do so? Does this put more load on the application? At the moment I'm just autoloading the libraries and helpers I'll be using throughout my application: $autoload['libraries'] = array('database', 'session', 'parser'); $autoload['helper'] = array('url', 'form'); So I'm basically wondering if this is 'okay' to do or if I should just load some

Zend Module Bootstrap does not load

柔情痞子 提交于 2019-12-10 18:51:55
问题 I have a very strange case where my Module is working but my Module's boostrap is not being loaded. Here is the segment in my application.ini for module autoloading: resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.modules[] = "" Here is the bootstrapper: protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'User_', 'basePath' => APPLICATION_PATH .'/modules/user', 'resourceTypes' => array ( 'model' =>

Composer Autoload - Can't find class

妖精的绣舞 提交于 2019-12-10 18:44:54
问题 I have a little Silex app going on. Trying to get some sort of structure going on. This is my composer.json : { "require": { "silex/silex": "~1.3" }, "autoload": { "psr-0": { "HelloWorld\\Controller": "src/HelloWorld/Controllers" } } } In my web/index.php file I have this $loader = require_once __DIR__.'/../vendor/autoload.php'; $ctrl = new \HelloWorld\Controller\IndexController(); // <- Doesn't work My IndexController controller in src/HelloWorld/Controllers namespace HelloWorld\Controller;

Prestashop, cannot require Module class

蓝咒 提交于 2019-12-10 18:36:06
问题 Problem Related issue, I have been trying to apply related solution to my project, however I am not able to execute Module::getInstanceByName('modulename'); I do not even have access to Module class, which makes it hard for me to access application context and my own module context class_exists('Module') Returns false . I also provide the directory structure of my module from which I am attempting to access Module . ├── mymodule.php ├── config.xml └── somedirectory └── index.php Where