Re: How about using real HTML templates for Form input fields?

2011-11-04 Thread AD7six


On Nov 4, 2:47 am, Miles J mileswjohn...@gmail.com wrote:
 Ive always wanted this. Cakes defaults are pretty handy but once you
 want to break out of the norm it gets tedious.

 I would also change the HTML structure but thats just me :P

 @Sherlock - There's not much overhead in doing a basic PHP include.

using elements instead of the existing str-replace logic will have a
noticeable performance degredation.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How about using real HTML templates for Form input fields?

2011-11-04 Thread majna
@sams and @AD7six 
Yes, one element for each input. Performance is not issue here. Finally, 
you can cache those elements as any other View::element() calls.

This is not only about applying Twitter Bootstrap. FormHelper is not 
flexible enough and extending large methods is not best solution. 
It's hard for frontend coders to use Cake forms.. They wont HTML back.

I think FormHelper is reaching his maximum now. Code is complicated, a lot 
of code inside goes to formatting and can be wiped out
if templates are used.

Only drawback for using templates is case when you need just-a-bit 
different input in some place.
Now you can pass option to helper, but with templates you have two options:
- to create new template
- to mess up templates using conditional logic inside.

I luv this template idea, and I hope templates could fit into existing 
FormHelper as alternative (option to use templates), without breaking BC 
and preserving API, but requires a lot of refactoring.






-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How about using real HTML templates for Form input fields?

2011-11-04 Thread AD7six


On Nov 4, 11:41 am, majna majna...@gmail.com wrote:
 @sams and @AD7six
 Yes, one element for each input. Performance is not issue here. Finally,
 you can cache those elements as any other View::element() calls.

Try what you're suggesting and benchmark it before dismissing
performance - rendering elements is not free.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


How about using real HTML templates for Form input fields?

2011-11-03 Thread majna
Instead of using array based options for FormHelper inputs like: label, 
before, after, div, format etc.
maybe HTML templates would be more friendly and easier to customize. For 
each input type there will be one Cake element as template.

Here is an example, a proof of concept on how it may look like:
https://gist.github.com/1337871

I think this is more flexible and it does not require for developers 
(designers) to master FormHelper API just to customize HTML.
Those templates could be theme specific (like Twitter Bootstrap) and 
shared as plugin.
There are some drawbacks of course.

Would you use smth like this? 
Comments are welcome

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How about using real HTML templates for Form input fields?

2011-11-03 Thread Sam Sherlock
So you'd get increased flexiblity (in markup control) but at what cost.

additional overhead (an element for each form input)
and having to make a range of elements for various differing situations

or maybe I am missing the point - I am certain that you can do this without
the need to call
a Cake Element for every form element.

am I missing something

 - S



On 3 November 2011 22:17, majna majna...@gmail.com wrote:

 Instead of using array based options for FormHelper inputs like: label,
 before, after, div, format etc.
 maybe HTML templates would be more friendly and easier to customize. For
 each input type there will be one Cake element as template.

 Here is an example, a proof of concept on how it may look like:
 https://gist.github.com/1337871

 I think this is more flexible and it does not require for developers
 (designers) to master FormHelper API just to customize HTML.
 Those templates could be theme specific (like Twitter Bootstrap) and
 shared as plugin.
 There are some drawbacks of course.

 Would you use smth like this?
 Comments are welcome

  --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How about using real HTML templates for Form input fields?

2011-11-03 Thread 100rk
 Those templates could be theme specific (like Twitter Bootstrap) and

IMHO only not-so-easy solvable problem with Twitter Bootstrap and cake
forms is - label wrapped around checkboxes, for both single-ones and
'multiple' (wrapped in unordered lists). Rest of it is easy, thanks to
'className' key in $helpers and custom aliased YourFormHelper (and
probably also YourHtmlHelper with either customized $_tags property or
using 'configFile' configuration setting and proper config file with
customized and/or added tags in it) where you can inject/set classes/
divs etc before call of parent class (FormHelper) methods.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How about using real HTML templates for Form input fields?

2011-11-03 Thread Miles J
Ive always wanted this. Cakes defaults are pretty handy but once you
want to break out of the norm it gets tedious.

I would also change the HTML structure but thats just me :P

@Sherlock - There's not much overhead in doing a basic PHP include.

On Nov 3, 6:21 pm, 100rk lubomir.st...@gmail.com wrote:
  Those templates could be theme specific (like Twitter Bootstrap) and

 IMHO only not-so-easy solvable problem with Twitter Bootstrap and cake
 forms is - label wrapped around checkboxes, for both single-ones and
 'multiple' (wrapped in unordered lists). Rest of it is easy, thanks to
 'className' key in $helpers and custom aliased YourFormHelper (and
 probably also YourHtmlHelper with either customized $_tags property or
 using 'configFile' configuration setting and proper config file with
 customized and/or added tags in it) where you can inject/set classes/
 divs etc before call of parent class (FormHelper) methods.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How about using real HTML templates for Form input fields?

2011-11-03 Thread LunarDraco
In 2.0 you solve this tedious by building/subclassing formhelper.
Using the alias feature and writing your own functions to support your
needed/different template and format.

On Nov 3, 7:47 pm, Miles J mileswjohn...@gmail.com wrote:
 Ive always wanted this. Cakes defaults are pretty handy but once you
 want to break out of the norm it gets tedious.

 I would also change the HTML structure but thats just me :P

 @Sherlock - There's not much overhead in doing a basic PHP include.

 On Nov 3, 6:21 pm, 100rk lubomir.st...@gmail.com wrote:



   Those templates could be theme specific (like Twitter Bootstrap) and

  IMHO only not-so-easy solvable problem with Twitter Bootstrap and cake
  forms is - label wrapped around checkboxes, for both single-ones and
  'multiple' (wrapped in unordered lists). Rest of it is easy, thanks to
  'className' key in $helpers and custom aliased YourFormHelper (and
  probably also YourHtmlHelper with either customized $_tags property or
  using 'configFile' configuration setting and proper config file with
  customized and/or added tags in it) where you can inject/set classes/
  divs etc before call of parent class (FormHelper) methods.o

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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