Re: [SMARTY] A question about Smarty and MVC...

From: Date: Fri, 14 Mar 2003 03:48:34 +0000
Subject: Re: [SMARTY] A question about Smarty and MVC...
References: 1 2 3 4 5 6  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8636@lists.php.net to get a copy of this message
Guys, sorry about the incomplete message earlier...I hit the wrong key ;-). Jason, Thanks for the links. I've read the articles. Good, but I don't think they address my initial question. Let me restate it a bit: If I were to design an MVC application with Smarty/PHP, could I consider the script that accepts user input to be the controller, Smarty to be the view, and any classes the controller calls based on user input (including the business logic and database classes) to be the view? So, if I have the following code: <?php // get name from request $name = $_REQUEST["name"]; // get id from database $id = myDatabaseObject.someDatabaseQuery($name); $smarty = new Smarty; $smarty->assign('id', $id); $smarty->display('viewId.tpl'); ?> Then, if I understand correctly, the above script would be viewed as the part of the Controller, because it accepts user input and forwards it to the appropriate places. The myDatabaseObject would be considered part of the model, and the Smarty class and tpl would be considered the view. Is this totally off base? If so, how? Thanks! John > Hi John, > > You might want to take a look at > http://www.zend.com/zend/tut/tutsweatpart1.php and > http://www.zend.com/zend/tut/tutsweatpart2.php which I wrote > about a > year ago. This is just a php script that is a framework that can > encapsulate a small application within a single php script and a single > template. In the context of this script. The script itself acts as the > controller. The model - business logic - is cases of the first switch > statement, and views are implemented in the second switch.

« previous php.smarty.general (#8636) next »