Example of mvc

Posted by  jayprakash sharma
JQuery  PHP  Mvc 
 1835  View(s)
Rate this:

this is a General Question about MVC ..

I wrote a PHP Class that send an Array with Core JsonData Strings to Jquery .. and on Jquery i´m accessing the data and add them to my views ( .append("htm stuff"+jsondata) )

now the Jquery is calling the data from a between.php page that has a catch block with many cases, and upon the called case/function , the between page is calling a function from the php class that sends the json data ..

so i have my oop php model that send the core jsondata , a controller ( catch block), and the view ( the jquery page) .. is this kind of MVC ? or i did miss understand it ?

an example of my code was posted on a previous Question here.

  1. Re: Example of mvc

    Looking at the code you posted in your other post it is not a MVC implementation. Or at least it is a bad implementation.

    The MVC is about seperating your presentation from your business logic. Looking at your POST class you don't seperate your business logic from your view:

    public static function readPosts(){
        $query = new Post_db("SELECT * FROM pmessage
                              ORDER BY p_id DESC
        $posts = array();
        while($row = $query->fetchRow()){
            $posts [] = new Post($row);
        foreach($posts as $item){
            echo $item;

    In this function you get information from your database (business logic) and print content (view). In other words, you combine your MV in one method. So I would say: No, this is not MVC.

      Modified On Apr-06-2018 06:50:16 AM