Ok I've got the patch working on the SmartyHtmlHelper class to use the
underscore-delimited attribute names, and to recursively build arrays
from the attributes list if required.

It works pretty sweet...  I'm just trying to sort through how to upload
it to CakeForge now...



On Nov 2, 11:38 am, "sbarre" <[EMAIL PROTECTED]> wrote:
> Ok I see what you're doing, I like it..
>
> The other idea I had, to avoid doing the collapsed array trick would be
> to use the parameter name to identify array elements..   Since all the
> parameters are camelCased we could use dashes or underscores (would
> dots work?) to identify arrayed values...
>
> So you could have (for example):
>
> {html func="input" fieldName="User/username"
> htmlAttributes_class="formInput" htmlAttributes_size="30"}
>
> or something like that.  That might be a bit cleaner in the template,
> and I'd lean towards keeping the templates clean and clear and having
> more " figurin' " code in the plugin..   When you parse the parameters
> you can split on the underscore and build the attributes array that
> way..   The reason I'm leaning towards this approach is because the
> fake-array method falls apart if any of the array values need to be
> arrays themselves.  I don't know of a helper method where this is the
> case, but it would be nice to future-proof this code a bit.   I'm
> starting a big project and I don't doubt that I will end up writing my
> own helpers at some point..
>
> With the underscores method, you can (in theory) keep adding
> underscores and in the plugin code parse it down into a
> multi-dimensional array if you really had to, and it would not require
> changes to the code.
>
> So you could have (this is a bad example but it will do to illustrate
> the point):
>
> {html func="input" fieldName="User/username"
> htmlAttributes_style_padding="5px" htmlAttributes_style_color="#F6F6F9"
> htmlAttributes_size="30"}
>
> In code this would convert to
>
> htmlAttributes => array(
>  size => "30"
>  style => array(
>     padding => "5px",
>     color => "#F6F6F9"
>   )
> )
>
> or something like that..
>
> Lemme try to patch that into your existing helper (which is excellent
> so far BTW) and we'll see where it goes..
>
> On Nov 2, 5:18 am, "Travis Cline" <[EMAIL PROTECTED]> wrote:
>
> > On 11/2/06, Travis Cline <[EMAIL PROTECTED]> wrote:> Whoops!Whoops again.
>
> > A couple problems/enhancements.
> > If there are parameters after the array parameter that are passed in
> > the order in the actual call is off.
> > Hopefully you get the idea, feel free to up a new version seb.
>
> > It might make sense to seek default values through reflection if we're
> > passing in after that -- looking at $html->css and the like.
> 
> > Travis


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to