Re: [SMARTY] A question about Smarty and MVC...
| From: | Jason Sweat | Date: | Thu, 13 Mar 2003 03:30:14 +0000 |
| Subject: | Re: [SMARTY] A question about Smarty and MVC... | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8602@lists.php.net to get a copy of this message | ||
Hi John,
I have developed several applications recently using the Phrame
http://phrame.itsd.ttu.edu/ MVC framework. I posted a
modification to their
hello world modified to use smarty on the sourceforge list archive (which
appears to be down at the moment).
Here is a summary I sent to someone asking about performance:
I have been very happy with the implementation of a MVC using Phrame. I
have
gone in and performed some "tweaks" to the implementation for performance.
Chief among these were:
a) change to return and pass-by-reference all of the functions that use
objects
b) eliminate the mappings array by using a mapping object (posted somewhere
up
on the list archives)
c) implementation of view objects, with coupling of the views done by
extending
the controller class.
d) adding an exit command after the forward in
Controller::_processForward().
All of my implementation have an extended controller class running the show.
There is basically 1 file I hit that:
1) includes the framework, other libraries and defines
2) creates a global database connection object (adodb, used by my model
classes)
3) checks if action then $controller->processaction() else
$controller->showview()
The extended controller class adds ShowView() _IsValidView() and
_SetViewClass.
ShowView determines if a valid view was passed, else sets a default
then determines the class associated with that view
instantiates a copy of that class
instantiates a Smarty object
sets some global assigns to the Smarty object
calls the $view->Render($smarty)
Each view class gets data from appropriate model classes, assigns to the
smarty
instance passed in, then displays the results.
I have been reasonably happy with the performance. If you have a PHP
accelerator, you will probably have no problems at all.
Be ware of trailing spaces on any of your include files. This causes a
symptom
of a blank page returned rather than an action class forwarding.
HTH
Jason
----- Original Message -----
From: "John Wells" <jb@sourceillustrated.com>
To: <smarty-general@lists.php.net>
Sent: Wednesday, March 12, 2003 9:20 PM
Subject: [SMARTY] A question about Smarty and MVC...
> I'm a relative newbie to MVC and trying to develop a complying application
> with PHP and smarty. As I learn more about Smarty and MVC, I have a
> question(s):
>
> Aren't most Smarty-based applications not truly MVC? Wouldn't they be
> considered more of a Model-View approach, leaving out the Controller
> portion? Or would Smarty itself be considered the "control" in this case,
> since it essentially does "forwards" ($smarty->display('my.tpl')) and
> that
> could be considered a controller function?
>
> Thanks for your input...
>
> John
>
>
>
>
>
>
>
>
>
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>