Jump to content

Is this MVC ?


lampstax

Recommended Posts

I could have sworn this was MVC last week.  This week I am not so sure.

 

Can anyone make a positive id for this technique I am using ?

 

Bird.php

 

class Bird {

   public function fly() { .. do flying .. }

   public function eat() { .. find some food .. }

   .. other birdiness functions ..

}

 

BirdController.php

 

require_once('RandomStuff.php');

$b = new Bird();

$action = $_GET['action'];

if ($action = 'eat' ){
   $b->eat();
   require_once('showeat.php');
}

else if ( $action = 'fly' ){
   $b->fly();
   require_once('showfly.php');
}

 

 

showeat.php

 

echo "eating a .. ".$b->getFoodType();

 

showfly.php

 

echo "wheee .. flying at ".$b->getAltitude();

Link to comment
https://forums.phpfreaks.com/topic/116096-is-this-mvc/
Share on other sites

So I was reading some stuff and it says the view object registers as an observer for the model object.

 

How does that work for my code?

 

How does a display page ( maybe html with smarty placeholders ) register as an observer for the bird object ?

 

The more I read of this MVC stuff, the less I understand.  =T

Link to comment
https://forums.phpfreaks.com/topic/116096-is-this-mvc/#findComment-597014
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.