lampstax Posted July 22, 2008 Share Posted July 22, 2008 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 More sharing options...
lampstax Posted July 22, 2008 Author Share Posted July 22, 2008 I m thinking that model = bird.php controller = birdcontroller.php view = showeat.php, showfly.php Am I wrong ? Link to comment https://forums.phpfreaks.com/topic/116096-is-this-mvc/#findComment-596983 Share on other sites More sharing options...
trq Posted July 22, 2008 Share Posted July 22, 2008 Yeah, full of syntax errors but thats the basic gist of it. Link to comment https://forums.phpfreaks.com/topic/116096-is-this-mvc/#findComment-596993 Share on other sites More sharing options...
lampstax Posted July 23, 2008 Author Share Posted July 23, 2008 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 More sharing options...
trq Posted July 23, 2008 Share Posted July 23, 2008 There are many different ways of going about developing the mvc pattern. Yours is a very basic implimentation that does not go into the detail you describe. Link to comment https://forums.phpfreaks.com/topic/116096-is-this-mvc/#findComment-597024 Share on other sites More sharing options...
lampstax Posted July 23, 2008 Author Share Posted July 23, 2008 Can you help suggest some improvement to it ? How would I make it 'observe' with PHP ? Or is that too general a question ? Link to comment https://forums.phpfreaks.com/topic/116096-is-this-mvc/#findComment-597047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.