You have to provide ?url= in the address bar. If that is missing, you get the index error. You can change it to this:
$url = isset($_GET['url']) ? $_GET['url'] : '<no url set>';
echo $url;
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86
What did you do? Pasting an error without showing your code is kinda useless.
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86
Show your code, not the call stack. Although the last error says the file does not exist, so you need to check that before you include it.
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86
If there is no url specified, the require will fail, that is why you have those messages. You will have to call it as I specified earlier, or add error checking.
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86
The problem may be:
require 'controllers/' .$url; // this should open controllers/index.php
$controller = new $url; // this should be Index (the class name)
The following could help:
require 'controllers/' . strtolower($url) . '.php';
$controller = new $url;
If you want to open index.php?url=Index
pritaeas
Posting Prodigy
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86