[Solar-talk] Example Solar Code

Michael Soule mikesoule at gmail.com
Sat Mar 17 15:32:23 PDT 2007


Thanks Andreas!

Can someone elaborate on layouts/views? There seems to be several  
different ways to set up templates. What are some general guidelines  
to follow? Also, I'm a little confused about the relationship between  
layouts/views. It appears that layouts are composed of the the html  
shared by a group of pages and the views contain html specific to a  
given page or action. Is this correct? Is there more to it than that?

mike



On Mar 17, 2007, at 6:44 AM, Andreas Ravnestad wrote:

> Michael Soule wrote:
>> I'm getting a little lost in all the abstractions here. I was
>> concerned at first that Solar might not be flexible enough to do what
>> I need but instead I'm finding it's so flexible that I'm having
>> trouble determining the structure of my App. When you guys build a
>> site, do you create both a model and a page controller for each
>> individual page or do you make one class handle multiple pages by  
>> just
>> creating several different actions? If I have pages such as Home,
>> Categories, Portfolios, Search Results, Login, and Registration...
>> should I have a separate page controller for each of those?
>>
>> --
>> mike
> Hi!
>
> Yes you should have separate page controller for those :) But  
> that's not
> a rule, just a guideline. We all know web development is seldom as
> simple as we envision when we start out on an application :)
>
> I usually write my controllers in singular (not plural), most often  
> one
> controller corresponding to some model:
>   Home (or Default)
>   Category
>   Portfolio
>   SearchResult
>   Login
>   Register
>
> For each of these I create the controller file + the related
> directories. For example, for some application called "Account"  
> with two
> controllers (Profile and User), I create the following:
>
> Account/App/Profile.php
> Account/App/Profile/Helper
> Account/App/Profile/Layout
> Account/App/Profile/Locale
> Account/App/Profile/View
>
> Account/App/User.php
> Account/App/User/Helper
> Account/App/User/Layout
> Account/App/User/Locale
> Account/App/User/View
>
> And also:
> Account/App/Helper
> Account/App/Layout
> Account/App/Locale
> Account/App/View
>
> I may have forgotten something, but this is the most important to  
> me :)
> In addition to this I usually create default actions for my  
> controllers,
> almost exclusively naming them "index". I try to create my controllers
> and actions so they will yield urls looking like this:
>     http://account.something.com/profile/index
>     http://account.something.com/profile/details/10  (view the details
> on account with id 10)
>     http://account.something.com/user/login
>     http://account.something.com/user/register
>
> And so on. I hope this was of some help. I'm sure the other app
> developers here have their own styles as well :)
>
> -AR
> _______________________________________________
> solar-talk mailing list
> solar-talk at lists.solarphp.com
> http://mail.killersoft.com/mailman/listinfo/solar-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.killersoft.com/pipermail/solar-talk/attachments/20070317/13532e84/attachment.htm 


More information about the solar-talk mailing list