Home > DeveloperSection > Forums > Example of mvc
jayprakash sharma
jayprakash sharma

Total Post:117

Posted on    November-17-2014 11:02 PM

 ASP.NET MVC JQuery  PHP  Mvc 

 1 Reply(s)
 1022  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.

Pravesh Singh
Pravesh Singh

Total Post:101

Posted on    November-18-2014 2:10 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick