Re: autoload perplexity Programming Web Development by veedeoo … composer phpunit swifmailer symfony autoload.php composer.json 7.…phpunit myclass swifmailer symfony autoload.php composer.json 8.… Autoload with different directory Programming Web Development by chozotheqhai …this problem. Thanks you. Website -classes -core.php -inc -autoload.php -config.php -index.php **Index.php** <?php …require_once('inc/autoload.php'); $core = new Core(); $core->run(); **autoload.php** <?php require_once('config.php… Re: Autoload with different directory Programming Web Development by deviantmind You're probably getting something in the line of this: Warning: require_once(Core.php): failed to open stream: No such file or directory in (yourpath)\inc\autoload.php on line 8 Fatal error: require_once(): Failed opening required 'Core.php' (include_path='./') in (yourpath)\inc\autoload.php on line 8 I am stuck with the same problem Re: Autoload with different directory Programming Web Development by Gideon_1 To autoload classes, the standard php library which is already built in … autoload perplexity Programming Web Development by PerplexedB Am I right to assume that autoload is a performance issue rather than making my life easier as a developer? I mean if I put all my classes in one include, and I don't have any performance issues, should I be worried about autoloading at this early stage of my learning curve? Thanks for any light you would care to shed on this. Re: autoload perplexity Programming Web Development by pritaeas You may want to have a look at [this](http://php.net/autoload). Re: autoload perplexity Programming Web Development by PerplexedB … being. Another thing that I find strange is that you autoload the class by its name, so how do you manage… Composer autoload - Not autoloading class from include file Programming Web Development by klemme ….*", "illuminate/validation": "4.0.*" }, "autoload": { "psr-4": { "App\\": "app… Re: Autoload with different directory Programming Web Development by veedeoo What kind of error are you getting? Re: Autoload with different directory Programming Web Development by gabrielcastillo Try: `require_once($_SERVER['DOCUMENT_ROOT'] . '/inc/config.php');` Re: Autoload with different directory Programming Web Development by diafol You need to state the error you're getting. Re: Autoload with different directory Programming Web Development by pol.bala You may be don't need this answer anymore, but I am answering. I am having the same problem. So I tried again and again, then found the problem and solve. Everything is right in the code except require_once('config.php'); Please replace that with require_once('inc/config.php'); Now you are done. Because it wasn't getting the … Re: Autoload with different directory Programming Web Development by diafol \I notice it was deemed necessary to resurrect this post. So here: http://www.php-fig.org/psr/psr-4/examples/ Re: autoload perplexity Programming Web Development by minitauros You mean if you include all your classes at once? Of course, that does impact your performance in a way, but it will probably not be significantly in small projects. A question though: why would you include classes that you don't need on every page? Re: autoload perplexity Programming Web Development by PerplexedB Thank you very much for caring. Well I thought that would just be easier. I thought I'd register (include really) all my classes as I develop them in one includes.php, and include that in each "view" page I develop. I thought that that was how that was "done". Please set me straight if it is not. Re: autoload perplexity Programming Web Development by minitauros It is indeed done like that, in general, for as far as my knowledge goes :). However, if you for example have a Registration class, that helps members register an account for your website, I wouldn't include it on pages that only registered people can see, personally, as it wouldn't have any use if it only helps non-registered members register an … Re: autoload perplexity Programming Web Development by minitauros Yes the __autoload() function is a useful one, but I myself don't like to rely solely on that. The manual itself specifies: > By calling this function the scripting engine is given a **last chance** to load the class before PHP fails with an error. But playing around with it and getting to know how it works can be useful. Maybe you like it … Re: autoload perplexity Programming Web Development by minitauros Well I haven't used spl_autoload ever, but for as far as I can see when I read the manual, it's worth checking it out. An example of my use of the __autoload() function (dates from over 2 years back, so it's just an example, not sure about the current standards): function __autoload($class_name) { if(file_exists('includes/classes… Re: autoload perplexity Programming Web Development by pritaeas Perhaps [this article](http://www.sitepoint.com/autoloading-and-the-psr-0-standard/) may help you. Re: autoload perplexity Programming Web Development by minitauros Do you use any kind of autoloader, pritaeas? Re: autoload perplexity Programming Web Development by pritaeas Not at this moment. But if you're referring to my ORM thread, I'm leaning towards using the PSR-0 version. Re: autoload perplexity Programming Web Development by PerplexedB Many thanks. Re: Help with Namespaces & Autoload Programming Web Development by pritaeas I came across this [SO thread](http://stackoverflow.com/questions/5682089/php-namespaces-autoload), not sure if yours is the same issue though. autoload url from php script Programming Web Development by dietdew12z Basically what I'm doing is an if.then.else and depending on a value in the DB it's supposed to load one page or another. Right now I have it kluged together with a submit button but I'd like it to load automatically. This PHP script sits alone with no HTML output, it just searches the database for an item. If that item is found I want it to … Re: autoload url from php script Programming Web Development by potatoe php header function or javascript's window.location Re: autoload url from php script Programming Web Development by AgentPickles [CODE] <?php header('Location: http://www.yoursite.com/new_page.html'); ?> [/CODE] Re: autoload url from php script Programming Web Development by dietdew12z [QUOTE=AgentPickles;1233811][CODE] <?php header('Location: http://www.yoursite.com/new_page.html'); ?> [/CODE][/QUOTE] That *is* MARVELOUS! Thank you, it worked like a charm. After two days of beating my head against this problem it was such a beautiful sight to see it seamlessly load the correct page. Thanks again! David Re: autoload url from php script Programming Web Development by dietdew12z [QUOTE=dietdew12z;1234153]That *is* MARVELOUS! Thank you, it worked like a charm. After two days of beating my head against this problem it was such a beautiful sight to see it seamlessly load the correct page. Thanks again! David[/QUOTE] It worked great until I started putting code into it. :) I chanced across this method <?php… autoload issue, string getting changed? Programming Web Development by Kognition This is boggling my mind. I wrote a quick auto-loader and it appears to work like it is supposed to, except that it keeps changing the argument $class from the class name to "self". Here is the code (followed by further information on what I've tried): [CODE] public static function load($class) { $found = false; foreach (self::$… Re: autoload issue, string getting changed? Programming Web Development by Kognition So it turns out that the autoloader was getting called on "self" for some reason. Perhaps it forgot that self:: isn't a class, but rather a keyword. Either way, a simple if ($class == "self") return; took care of that problem. God, I need to sleep. >.> Solution: (Don't judge me :)) [CODE] public static function load($…