model view controller - How do you use the MVC paradigm in PHP with ADODB as your DAL? -
model view controller - How do you use the MVC paradigm in PHP with ADODB as your DAL? -
no orm. know have php 5+ , adodb. two, how can utilize mvc? cannot utilize other frameworks , i"m not asking build scratch (i want learn!). how start off here? know how mix things incorrectly classic asp style. don't know how do, on very basic level mvc. had model adodb , sql, how go "model" view? or how phone call controller since don't have orm call?
can give me concrete? hoping basis of future cms.
thanks
there nil magical mvc. it's purpose split user interface interaction 3 distinct roles. of import separation between model , presentation layer. presentation layer consists of controller (handles , delegates request ui model) , view (renders model data).
your model core application. layered itself, instance info access layer (your adodb stuff), domain model , service layer. how organize model application want build. of import thing mvc maintain model independent presentation. application should able solve problem written without ui.the ui 1 interface on top.
basically, long controller kept lean , this
class somecontroller { public function someaction() { $input = filter_input(/* ... */); $adodb = $this->getmodel('myadodbclass'); $newdata = $adodb->dosomethingwithinput($input); $this->getview()->setdata($newdata); $this->getview()->render(); } }
and not this
class somecontroller { public function someaction() { $input = filter_input(/* ... */); $adodb = new adodb; /* code belongs dosomethingwithinput ... */ echo '<html>'; /* code should belongs view ... */ } }
you fine. said, there nil magical about. gotta maintain 'em separated.
i suggest have @ other frameworks see how approach mvc. that's not should re-create or utilize them, seek larn how go mvc. have @ rasmus lerdorf's article no-framework php mvc framework
php model-view-controller
Comments
Post a Comment