We are thrilled to inform you that Lancecourse is NOW INIT Academy — this aligns our name with our next goals — Read more.

It seems like you are using an ad blocker. To enhance your experience and support our website, please consider:

  1. Signing in to disable ads on our site.
  2. Sign up if you don't have an account yet.
  3. Or, disable your ad blocker by doing this:
    • Click on the ad blocker icon in your browser's toolbar.
    • Select "Pause on this site" or a similar option for INITAcademy.org.

PHP Frameworking - Introduction (Part 1)

By Matej 10 years ago
PHP Frameworking discussion!

8 Comments

Sign in to reply

10 years ago Reply
Really nice and well written. :)
10 years ago Reply
good article.
It helps to understand how object oriented programming is implemented.
zooboole
zooboole
10 years ago Reply
Thanks @Matej Sima.
This is a lovely post. i like the way you started the post.
zooboole
zooboole
10 years ago Reply
Perfectly followed the tutorial, it works **impec**.

For those on windows who may have a problem with the relative include path, think of using __DIR__ like this:

require_once(__DIR__.\\\'/../core/view/viewLoader.php\\\');
require_once(__DIR__.\\\'/../core/view/view.php\\\');

Or if you are using php version bellow php 5.3 you may have to use this to require files:

require_once(dirname(__FILE__).\\\'/../core/view/viewLoader.php\\\');
require_once(dirname(__FILE__).\\\'/../core/view/view.php\\\');



Also for those like me who are running it from WAMPSERVER or its mates, run it from:

> http://localhost/your-project-folder/public


----------


[Reference][1]


[1]: http://stackoverflow.com/questions/5371828/relative-path-in-require-once-doesnt-work
zooboole
zooboole
10 years ago Reply
Another thing one could do is to have a .htaccess file in our root folder that will handle our requests.
So, every request made like:

http://localhost/your-project-folder/something

Will always go through public/index.php

I used this for now:

RewriteEngine On
RewriteRule . public/index.php
10 years ago Reply
Awesome post!!!
Steve
Steve
9 years ago Reply
Yes, this worked from the start when I copied it as written. When I tried to actually type it all out, not so much. I probably made a few hard-to-spot typos. But this short tutorial works!
Steve
Steve
9 years ago Reply
I had the same errors as Auto Default. I then moved the 'BASEPATH' definition to the bootstrap.php file and it worked. Not sure why the 'BASEPATH' definition in the config.php wouldn't follow through on the require statement in the bootstrap.php file. I copy/pasted all the code to make sure that it wasn't me making weird typing errors that I couldn't spot. Weird! But nevertheless, this was great little tutorial! It went a long way toward helping me to understand the general nature of how all those php frameworks operate.