Questions tagged [autoload]

autoload is a language convention which allows missing classes or method dependencies to be loaded on-demand.

autoload is implemented differently among languages which include it:

  • Perl's AUTOLOAD allows you to dynamically interpret method calls.
  • PHP's __autoload loads classes. To handle missing methods, the __call() magic method may be used.
  • Ruby's autoload command loads modules.
1633 questions
0
votes
2 answers

loading class with __autoload

I'm trying to write my site in Controller-Model-View convention without using any framework but I have a problem with __autoload function. Here's my source_folder/model/database.class.php file:
Arkadiusz Galler
  • 153
  • 1
  • 1
  • 8
0
votes
1 answer

Code Igniter Composer Twitter Bootstrap

Could somebody please explain to me how to integrate Twitter Bootstrap in Codeingniter 2.14 via Composer? I've included composer's autoloader into index.php like so: /************ COMPOSER AUTOLOADER *******************/ include_once FCPATH .…
0
votes
3 answers

Phalcon MVC model Exception

I'm trying to create an API with Phalcon for the first time. I have been followed the tutorial "http://docs.phalconphp.com/en/latest/reference/tutorial-rest.html", but encountered a problem. I've been created a new project with all the settings, and…
user3079839
  • 1
  • 1
  • 1
0
votes
1 answer

Reinit composer autoload

After updating via the Composer i want to initialize the application and send it events "scripts": { "post-update-cmd": [ "Acme\\Bundle\\DemoBundle\\Composer\\ScriptHandler::notify" handler public static function notify(CommandEvent…
ghost404
  • 299
  • 2
  • 16
0
votes
1 answer

PHP: Can the __autoload stack be persistent?

I think this cannot be done do to the fact the PHP is a stateless language. But I will ask anyway... I've created a home-grown MVC framework. The classes are all namespaced. On initial load I instantiate my custom Autoload class. A method of this…
Neil Girardi
  • 4,533
  • 1
  • 28
  • 45
0
votes
1 answer

spl_autoload and same filenames in different directories

The problem I am facing is that spl_autoload($class) passed in spl_autoload_register callback, will not load classnames which refer to the same filename, but in different directories. What I want to achieve is using spl_autoload, not using require…
Royal Bg
  • 6,988
  • 1
  • 18
  • 24
0
votes
1 answer

How to load stuff in /lib in a thread safe way?

I tried config.autoload_paths += Dir["#{config.root}/lib/**/"] and config.eager_load_paths += Dir["#{config.root}/lib/**/"] but keep getting the uninitialized constant error. I assume this has to do with dependency_loading being disabled as…
randomguy
  • 12,042
  • 16
  • 71
  • 101
0
votes
1 answer

php use one direction back

I'm trying to get working use. My file is in /application/controllers/indexController.php use application\models\Database; class IndexController extends Controller { public function indexAction() { $db = new Database(); …
0
votes
2 answers

Joomla class autoloading

I'm trying to extend a Joomla class, and I know that Joomla supports autoloading of classes. But if I have a class like class MyClass extends JModelList where do I need to save this file so it gets picked up automatically and I don't need to…
user101289
  • 9,888
  • 15
  • 81
  • 148
0
votes
3 answers

How do I use Google autoload to load JQuery?

How do I use Google autoload functionality to automatically load JQuery? http://code.google.com/apis/ajax/documentation/autoloader-wizard.html Reading the documention, I thought the below would work but doesn't.