May you see CleanMVC. That is the MVC that I created before 1-2 weeks.
Now I’m trying to create a router for CleanMVC.
Here is the router class that doesn’t run yet.
And using of router is below:
<?php
require_once '../library/router.php';
$router = new router();
$router->add(array('controller'=>':example', '-', 'function'=>'saffet', '-', 'data'=> ':variable' ,'.html'), function(){
echo 'just try';
});
$router->submit();
?>
I’m still getting url as /controller/function/data. This must run as example-saffet-$1.html. In a sense, if url will be example-saffet-exdataaa.html it must run like /example/saffet/exdataaaa. But this is just an example user will can create url whatever they want.
I wish I can tell. My purpose is creating a router like codeigniter’s…
EDIT:
Now, when I add this:
$router->add(array('controller'=>'example', '-', 'function'=>'saffet', '-', 'data'=> ':variable' ,'.html'), function(){
echo 'just try';
});
I get:
Array ( [data] => exxdataaa )
exxxdataaa is the what match with :variable section.