[Solar-talk] Solar_View

Paul M Jones pmjones at solarphp.com
Tue Oct 17 09:07:36 PDT 2006


On Oct 14, 2006, at 10:36 AM, Matt M. wrote:

> Before I get started... is there a better place to post code? I'd  
> like this to be considered for implementation to the source :)

This is the right place.  :-)  BTW, thanks for presenting an actual  
solution in code, too; that helps a great deal.


> I've noticed that the view class does not hold on the the template  
> path value. Everytime you render you have to tell it which template  
> to use, which means you can't pass it around to other objects and  
> render without the other objects knowing which template to use.

Not to be picky, but what other objects are you passing the view  
around to?


> I have a controller framework that allows child controllers to pass  
> their responses (Solar_View) to their parent, but then the parent  
> needs to know what template to use... which does not work.

I'd be interested to see code (even pseudo-code) outlining the  
problem; it may be that layouts are the solution for you here, but I  
can't say for sure.


> It's a simple fix...
>
> We need to add a new method called Solar_View::setTemplate($name){}

Funny, I had something much like that in Savant.  Turned out neither  
good nor bad to have it, but it did add a little bit of inconsistency  
in how people used it:  some did setTemplate() all the time, others  
did fetch($name) all the time, and still other mixed and matched.




--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list