I would like to ask for some tips, on how solve this problem. I\'m trying to build my own MVC website. I learned the basics of the URL.
http://example.com/bl
I think you are over thinking this one....
So the controller/resource is a blog....the method that all of them should run from is "read" (using crud...I usually call it data but basically its your select). Now just have your method accept a category value that automatically gets mapped based on the url....
here is a sample...completely untested but just to show you the idea (using pdo)
public function data($id = 0, $category = 0){
if (isset($id) AND $id != 0){
$bind = array(":id", $id);
$results = $db->query("SELECT * FROM blog WHERE blog_id = :id", $bind);
return $results[0];
} else if (isset($category) AND $id != 0){
$approved_categories = array("cosplay","game","movie","series");
if (in_array($category, $approved_categories)){
$bind = array(":cat", $category);
$results = $db->query("SELECT * FROM blog WHERE blog_cat = :cat", $bind);
}
return $results;
}
}