Re: method signature madness
I'm sorry, but I just don't get it. I am only passing TWO arguments to $Html-link and it works. I looked at $Html-link and it doesn't seem to do any parameter counting. I understand your point about me only passing two parameters, but please tell me why it works when calling $Html-link. //use of Html-link echo $html-link( 'linkTitle', array('controller'='candidates', 'action'='index') ); //Html-link method signature taken from html.php function link($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { On Mar 22, 11:15 am, brian bally.z...@gmail.com wrote: Again, you're only passing 2 params to your method--the title, and the URL array. You aren't passing anything for $htmlAttributes, so it defaults to the empty array. On Sat, Mar 21, 2009 at 10:07 PM, welzie wel...@gmail.com wrote: I forgot to include the method signature for the Html helper link method, which is the exact same as the signature for my helper method. That is why I was so confused because the call to that method works and the call to my method with the SAME exact signature does NOT work. Is there some magic that I'm missing? Here are the two method signatures. function link($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { Here are the two usages. Again the call to my method does NOT work. echo $html-link( 'linkTitle', array('controller'='candidates', 'action'='index') ); echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); On Mar 21, 9:47 am, brian bally.z...@gmail.com wrote: On Fri, Mar 20, 2009 at 11:35 PM, welzie wel...@gmail.com wrote: The call to my helper method that does NOT work. ?php echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); ? called with 2 params ... My helper class (not all methods are shown):: ?php class SimpleAuthorizationHelper extends Helper { var $helpers = array('Session', 'Html'); function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { ... 4 params, htmlAttributes is 3rd --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: method signature madness
On Mon, Mar 23, 2009 at 10:58 AM, welzie wel...@gmail.com wrote: I'm sorry, but I just don't get it. I am only passing TWO arguments to $Html-link and it works. I looked at $Html-link and it doesn't seem to do any parameter counting. I understand your point about me only passing two parameters, but please tell me why it works when calling $Html-link. How do you expect these to be anything but NULL? $controllerName = $htmlAttributes['controller']; $actionName = $htmlAttributes['action']; You are not passing a 3rd parameter, so $htmlAttributes is an empty array. You should have: $controllerName = $url['controller']; $actionName = $url['action']; --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: method signature madness
Again, you're only passing 2 params to your method--the title, and the URL array. You aren't passing anything for $htmlAttributes, so it defaults to the empty array. On Sat, Mar 21, 2009 at 10:07 PM, welzie wel...@gmail.com wrote: I forgot to include the method signature for the Html helper link method, which is the exact same as the signature for my helper method. That is why I was so confused because the call to that method works and the call to my method with the SAME exact signature does NOT work. Is there some magic that I'm missing? Here are the two method signatures. function link($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { Here are the two usages. Again the call to my method does NOT work. echo $html-link( 'linkTitle', array('controller'='candidates', 'action'='index') ); echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); On Mar 21, 9:47 am, brian bally.z...@gmail.com wrote: On Fri, Mar 20, 2009 at 11:35 PM, welzie wel...@gmail.com wrote: The call to my helper method that does NOT work. ?php echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); ? called with 2 params ... My helper class (not all methods are shown):: ?php class SimpleAuthorizationHelper extends Helper { var $helpers = array('Session', 'Html'); function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { ... 4 params, htmlAttributes is 3rd --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
method signature madness
I am trying to call $this-Html-link(...) in a helper method I created. My helper method has the same method signature as the Html- link method does, but for some reason the $htmlAttributes parameter is null. What I really don't understand is when I call the Html-link method with the same parameters it works. Below is an example of each. Please help me understand this. The call to html helper that DOES work: ?php echo $html-link( 'linkTitle', array('controller'='candidates', 'action'='index') ); ? The call to my helper method that does NOT work. ?php echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); ? My helper class (not all methods are shown):: ?php class SimpleAuthorizationHelper extends Helper { var $helpers = array('Session', 'Html'); function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { $controllerName = $htmlAttributes['controller']; $actionName = $htmlAttributes['action']; if ($this-isCurrentUserAuthorized($controllerName, $actionName)) { return $this-Html-link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle); } //more methods not shown } }? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: method signature madness
Hi, Try: class SimpleAuthorizationHelper extends AppHelper { On 21 Mrz., 04:35, welzie wel...@gmail.com wrote: I am trying to call $this-Html-link(...) in a helper method I created. My helper method has the same method signature as the Html-link method does, but for some reason the $htmlAttributes parameter is null. What I really don't understand is when I call the Html-link method with the same parameters it works. Below is an example of each. Please help me understand this. The call to html helper that DOES work: ?php echo $html-link( 'linkTitle', array('controller'='candidates', 'action'='index') ); ? The call to my helper method that does NOT work. ?php echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); ? My helper class (not all methods are shown):: ?php class SimpleAuthorizationHelper extends Helper { var $helpers = array('Session', 'Html'); function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { $controllerName = $htmlAttributes['controller']; $actionName = $htmlAttributes['action']; if ($this-isCurrentUserAuthorized($controllerName, $actionName)) { return $this-Html-link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle); } //more methods not shown } }? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: method signature madness
On Fri, Mar 20, 2009 at 11:35 PM, welzie wel...@gmail.com wrote: The call to my helper method that does NOT work. ?php echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); ? called with 2 params ... My helper class (not all methods are shown):: ?php class SimpleAuthorizationHelper extends Helper { var $helpers = array('Session', 'Html'); function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { ... 4 params, htmlAttributes is 3rd --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: method signature madness
I forgot to include the method signature for the Html helper link method, which is the exact same as the signature for my helper method. That is why I was so confused because the call to that method works and the call to my method with the SAME exact signature does NOT work. Is there some magic that I'm missing? Here are the two method signatures. function link($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { Here are the two usages. Again the call to my method does NOT work. echo $html-link( 'linkTitle', array('controller'='candidates', 'action'='index') ); echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); On Mar 21, 9:47 am, brian bally.z...@gmail.com wrote: On Fri, Mar 20, 2009 at 11:35 PM, welzie wel...@gmail.com wrote: The call to my helper method that does NOT work. ?php echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array ('controller'='candidates', 'action'='index') ); ? called with 2 params ... My helper class (not all methods are shown):: ?php class SimpleAuthorizationHelper extends Helper { var $helpers = array('Session', 'Html'); function createLinkIfAuthorized($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { ... 4 params, htmlAttributes is 3rd --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---