Hello.
I have been going through your php training video and i have done all up to php_advanced_pt2 which includes :
kp3-setting-up-htaccess-for-controllers.mov
kp4-dispatching-requests-to-multiple-controllers.mov
kp5-dispatching-views.mov
The first video seems fine but somewhere in kp4 and kp5 it all goes wrong and it doesn't work how it should.
I have been over and over it and can't find the problem. I have even installed your own files found in "php_advanced_sourcefiles / kp5-dispatching-views " and i am getting exactly the same errors.
I am using mamp pro and i have tried the script on php 5.2.17, php5.3.14 and php 5.4.4 which i am currently using.
My files are located in:
/Users/rickyspires/Sites/TRAINING/PHP_OOP/MVC/public
these are the errors i am getting:
Notice: Undefined offset: 2 in /Users/rickyspires/Sites/TRAINING/PHP_OOP/MVC/public/index.php on line 22
Fatal error: Uncaught exception 'Exception' with message 'Please implement a function called Action!' in /Users/rickyspires/Sites/TRAINING/PHP_OOP/MVC/site/app/controllers/ControllerAbstract.php:31 Stack trace: #0 /Users/rickyspires/Sites/TRAINING/PHP_OOP/MVC/public/index.php(37): site\app\controllers\ControllerAbstract->dispatch() #1 {main} thrown in /Users/rickyspires/Sites/TRAINING/PHP_OOP/MVC/site/app/controllers/ControllerAbstract.php on line 31
If i remove $pfx from list($pfx, $controllerName,$actionName) = preg_split('/[\/\\\]/',$uri); in index.php
it fixes the first problem because $pfx is not defined any where but it is probably not the correct thing to do.
and
if i remove
else
throw new \Exception("Please implement a function called $method!");
from ControllerAbstract.php it fixes the second error but is probably not the correct thing to do.
when i remove that code and go to my local site (http://training-mvc.com'>http://training-mvc.com) the site is blank
if i got to:
http://training-mvc.com its blank
http://training-mvc.com/index/ its blank
http://training-mvc.com/index/welcome its blank
Thank you
Ricky Spires