Questions tagged [autoloader]

An autoloader is a feature to allow classes and functions from different files to be included automatically when they are first called. This saves the need to explicitly include all of the files, or create a monstrous global functions/classes file.

388 questions
0
votes
0 answers

PHP Dynamic Namespaces in MVC

I'm starting a new app and have finally decided to join the new age using Namespaces. I'm finding myself constantly writing code like this: $dynamicControllerName = "MyController"; $controllerName = "System\\App\\Controllers\\" .…
Jeremy Harris
  • 24,318
  • 13
  • 79
  • 133
0
votes
1 answer

Symfony2 bundles in a different directory?

Here is the basic layout: mywebsite shared bundles MyWebsite CoreBundle src MyWebsite MyProduct ABundle shared is a submodule (git) but I need Symfony to be able to locate the shared bundles under the same…
Elliot Chance
  • 5,526
  • 10
  • 49
  • 80
0
votes
1 answer

Exempt one or more class by a Namespace autoloader

I am using in a project phpQuery for parsing HTML and Doctrine2 for DB persistence. Doctrine 2 uses an autoloader strategy based on namespaces, so f.e. when calling a \Doctrine\Orm\EntityManager it goes inside…
giuseppe
  • 827
  • 1
  • 9
  • 19
0
votes
1 answer

how to add another folder level to send framework autoloader?

i have this simple setup -controllers IndexController.php here somewhere i call new Application_Model_Sites_Sites() +layouts -models -sites Sites.php class Application_Model_Sites_Sites { ..…
Patrioticcow
  • 26,422
  • 75
  • 217
  • 337
0
votes
1 answer

PHP Auto-load and WordPress

I am having a weird issue with the autoloader class I built in PHP to use in WordPress. The core concept is that it should load class regardless of if you are a child theme, parent theme or a plugin. It should find the class based on the name…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
0
votes
1 answer

_initAutoloader database name same as class

I am new at Zend and i am learning. I am getting the following error: Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cddb.model_dbtable_albums' doesn't exist But the test tablename is albums in the database, if i change it to…
Bas
  • 2,330
  • 4
  • 29
  • 68
0
votes
1 answer

Symfonys Autoloader - Implement Parent Namespaces

I am using Symfonys Autoloader for a project having the following folder/class structure: App +- Package1 | +- Package2 +- Class1.php | - Interface1.php How do i implement a class from a parent namespace now. Like Interface1 from Class1 for…
0
votes
2 answers

Odd PHP Class autoloader Behavior - PEAR Related

I have a strange problem I can't figure out. I'm using PEAR to send mail from a PHP page. The Send_Mail class is working (sending mail using SMTP), but I'm getting this strange warning associated with my autoloader. Warning:…
nicorellius
  • 3,715
  • 4
  • 48
  • 79
0
votes
1 answer

magento model file not found / incorrectly included

I'm trying to add a module (it's called paypal-payment fee) to our magento shop, but as soon as its installed it produces an error on every shop site. Warning: include(FlyWebdesign_PaypalFee_Model_Sales_Quote_Address_Total_Paymentcharge.php)…
user1950929
  • 874
  • 1
  • 9
  • 17
0
votes
1 answer

ZF2 autoloading custom modules with composer

I'm trying to setup a ZF2 project (slightly different from the zf2skeleton) and I want to use composer to deal with all the autoloading, not only from the vendor ones (installed through composer) but also those modules I create. For some reason, i…
MGP
  • 653
  • 1
  • 14
  • 33
0
votes
3 answers

PHP Autoloader Function - still need require_once?

I'm getting my head around PHP autoloader. If I have the code below: function __autoload($class) {require_once('scripts/classes/' . $class . '.class.php');} so long as my classes are named to fit the path above should I still need to use…
Adam
  • 19,932
  • 36
  • 124
  • 207
0
votes
1 answer

Autoload Classmap in Laravel 4

I have a: // administration app/controller/admin/ProjectsController.php And I want use too: // public in website app/controller/ProjectsController.php But, in autoload_classmap.php, it's registred like that: 'ProjectsController' =>…
Patrick Maciel
  • 4,874
  • 8
  • 40
  • 80
0
votes
1 answer

How does namespaces and autoload work in Linux based systems, PHP?

So here is my code:
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
0
votes
1 answer

How to use autoload together with namespace in php?

I want to use the __autoload function.. For example I have two files in the same folder: index.php, MyClass.php MyClass.php is something like this: // filename: MyClass.php namespace SomeNameSpace; class MyClass{ public static function…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
0
votes
2 answers

Create directory and have all files automatically load everytime

I wanted to set up a config directory where all the files automatically inside this directory will be loaded with every page. My goal is to put a bunch of functions and defines in there so for example config/index.php config/defines.php and so and…
Yeak
  • 2,470
  • 9
  • 45
  • 71