Here's a Bin of the whole patched SmartyHtmlHelper class if you want to
take a look.  I figured we should sort out how it's going to work
before I submit it to CakeForge as a new version to yours.

http://bin.cakephp.org/view/1918458743



On Nov 2, 1:49 pm, "sbarre" <[EMAIL PROTECTED]> wrote:
> On Nov 2, 12:41 pm, "Travis Cline" <[EMAIL PROTECTED]> wrote:
>
>
>
> > How would you approach the $html->css issue, just require rel be
> > passed if you want additional parameters?Just to touch on this:
>
> I've implemented the following code to deal with this issue:
>
> foreach ($funcParams as $param) {
>         $paramName = $param->getName();
>         if (isset($processedParams[$paramName])) {
>                 $parameters[$paramName] =  $processedParams[$paramName];
>         } else {
>                 if ($param->isDefaultValueAvailable()) {
>                         $parameters[$paramName] = $param->getDefaultValue();
>                 } else if (!$param->isOptional()) {
>                         $smarty->trigger_error("SmartyHtml: Error 
> ".$paramName." parameter
> is required for method ".$function_name, E_USER_NOTICE);
>                 } else {
>                         $parameters[$paramName] = null;
>                 }
>         }
>
> }So you can see that when we build our final $parameters array that
> we're going to pass to call_user_func_array(), we loop through the
> Reflection-supplied list of all the method's parameters, and first we
> check to see if our smarty plugin supplied a value for this parameters,
> if so, we use it, if not we check if there's a default available, then
> we check if it's ok for the parameter to be missing (triggering an
> error if it's not) and then finally just setting it to null as a last
> resort.
>
> In the end you get a $parameters array that has all of the method's
> parameters in order, and you didn't even need to worry about that in
> your smarty plugin tag.


--~--~---------~--~----~------------~-------~--~----~
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