Re: [PHP] MVC: code in views
- Date: Sun, 3 Jan 2016 20:26:58 -0500
- From: jomali <jomali3945@xxxxxxxxx>
- Subject: Re: [PHP] MVC: code in views
I've found the Tiny But Strong (http://www.tinybutstrong.com) to be useful
in separating code from views. You might look into it.
On Sun, Jan 3, 2016 at 5:21 PM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx>
> On Sun, 2016-01-03 at 17:10 -0500, Stephen wrote:
> > On 16-01-03 04:43 PM, Ashley Sheridan wrote:
> > > Hi all,
> > >
> > > Just wanted to get some thoughts from others on the list. Recently I've
> > > been trying to avoid using any PHP code at all in my views at all, not
> > > even an if statement or for loop....
> > My work is not all that complex, but early on I decided to keep the PHP
> > code and the HTML as separate as possible. It makes things much easier
> > when I am adding pages, or creating a new web site.
> > I use CSS for all of the layout and styles of course.
> > The HTML is in a variable that I call $markup, and within that variable
> > are more variables that are populated by the PHP and contain the actual
> > content.
> I'm still keeping the HTML separate where possible, not a single tag is
> hard-coded into the PHP, and the HTML view files look like this:
> <div class="l-container">
> <p>some text</p>
> <ul class="l-list--floated unstyled">
> The template parts are then handled by class methods.
> Anything that would then require building HTML (like the form, for
> example) is built out of tons of snippets for the overall form and each
> element. This does mean loads of view snippets, but I think that's an
> acceptable trade-off.
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php