You should also consider who else will be looking at your view files.
I'm guessing that advocates of the HTML helper-only approach don't
need to hand their view files to other people who will be writing/
changing/styling the HTML. At my company, I do the bulk of the PHP
work, write basic HTML views (in static HTML), and then hand the view
files over to the designers so that they can style them for individual
websites. They're not CakePHP experts or even PHP experts, so giving
them a page full of PHP and saying "trust me, that's HTML" wouldn't go
over very well. If only one person will ever be maintaining the code
and you're sure that one person knows all about the HTML helper, then
sure.  But otherwise, if a few different hands (and not all of them
PHP-expert hands) will be playing with the HTML, I think writing it
'manually' is the better approach.

And maybe it's just because I learned HTML before PHP, but AD7six's
example looks very counter-intuitive to me. I like seeing HTML as
HTML, I find it hard to visualize a page when all the tags are
generated by helper functions. Being able to see the tags with proper
indentation helps me visualize the structure of the page, hunt down
and layout bugs, etc.

- Jamie

On Apr 23, 6:24 am, Ed Propsner <crotchf...@gmail.com> wrote:
> >@AD7six
>
> If the page was truly static then no, I suppose there would be no need to
> write an entire page with Cake, what would be the point?
>
> The use of all Cake tags was entirely experimental (curiosity) and I find
> nothing at all wrong with echo '<tag>';  echo '</tag>';
>  I don't really consider that "leaving" or jumping out of PHP ... your
> example however I would consider as such (which by the way makes me cringe
> to even look at):
>
> div id="<?php echo ($something)?$something:''; ?>" class="<?php echo
> empty($anotherBlankAttribute)?'':'moist'; ?>" etc.
>
> I've had my more than lazy moments in the past but to me that is just way
> too messy. Who would want to try and manage and entire site full of that? It
> makes my head hurt just thinking about it. To me it looks someone threw a
> bunch of code into a box, shook it up, and presto ... LOL, I'll have to coin
> that one "shake and bake"  8-)
>
> I will say that by using all cake tags on the page resulted in much more
> uniform and fluid code which brings to the table it's own set of benefits.
> Having said that it didn't have to be all cake either .. straight HTML, XML,
> Js ... all would have worked out just as well so long as it don't end up
> looking like "shake and bake." 8-)
>
> - Ed
>
>
>
>
>
> On Fri, Apr 23, 2010 at 5:46 AM, AD7six <andydawso...@gmail.com> wrote:
>
> > On Apr 23, 10:24 am, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> > > @Ed
>
> > Would you write your static pages - with cake? from your description -
> > you would (?).
>
> > For contrast/discussion this is the style I write (or more accurately
> > bake):
> >http://github.com/AD7six/time/blob/master/views/updates/multi_edit.ctp
>
> > I can't stand this style:
> > ...
> > <div id="<?php echo ($something)?$something:''; ?>" class="<?php echo
> > empty($anotherBlankAttribute)?'':'moist'; ?>" etc.
> > But even that has a (limited) use if it's clear to do so and the html
> > structure doesn't change. e.g.
> >http://github.com/AD7six/time/blob/master/views/layouts/default.ctp
>
> > it's also appropriate to do:
>
> > <?php if (test): ?>
> >  <div>
> >  <p>Something vaguely static
> >  ... etc.
> > <?php else: ?>
> >  <div>
> >  <p>Something not appropriate to build with php logic
> >  ... etc.
> > <?php endif: ?>
>
> > There's nothing wrong IMO putting echo '<tag>'; ... echo '</tag>';
> > inside your php code block if the sole reason to 'leave' is to
> > generate the tag and return/continue php logic.
>
> > In conclusion - You find a happy medium, and change your mind whenever
> > you find your choice was wrong for the direction your coding is
> > going ;).
>
> > Hth,
>
> > AD
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c 
> > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to