-- Duncan, Craig <[EMAIL PROTECTED]> wrote
(on Wednesday, 15 August 2007, 10:17 AM -0400):
> This one is very non-intuitive. Class names have their case preserved but file
> and directory names related to them have not .
> 
>  
> 
> Class: MyNewRssController
> 
> File: Mynewrsscontroller.php
> 
> Views: views/ mynewrsscontroller/myaction.phtml
> 
> Not sure why this was they decided to do it this way, it took a good look at
> the code to to convince myself this was deliberate.

There's several issues at play here:

    * PHP treats class names as case-insensitive
    * Some developers want CamelCased names
    * If you use a CamelCasedName class name, the actual file name needs
      to match in order to follow coding standards and allow for
      autodiscovery.

So, you *can* have the following:

    * Class: MyNewRssController
    * File:  MyNewRssController.php

For the router and dispatcher to successfully call it, however, you need
to separate the CamelCasedWords on the URL using word delimiters -- a
dash or a period:

    /my-new-rss/<action>
    /my.new.rss/<action>
    /my-new.rss/<action>


> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> 
> From: Simon Mundy [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 15, 2007 4:35 AM
> To: Greg Frith
> Cc: [email protected]
> Subject: Re: [fw-general] Routing problems - Invalid controller specified
> 
>  
> 
> No great magic here - your first server is obvious case-insensitive for
> filenames and the second is not.
> 
>  
> 
> The router uses CamelCase for its class names, but the _whole_ controller name
> is turned into word case for the sake of consistency. So MyNewRssController
> should really be written as MynewrssController in both the filename and the
> class declaration.
> 
>  
> 
> Cheerio
> 
> 
> 
> It works!
> 
>  
> 
> I didn't think this one was going to be so simple to solve!  Well kind of, so
> why is one box treating case differently to another??  I'll have to carefully
> read the docs on naming conventions.
> 
>  
> 
> Thanks Simon.
> 
>  
> 
> On 15 Aug 2007, at 08:50, Simon Mundy wrote:
> 
> 
> 
> Hi Greg
> 
>  
> 
> What happens on the new box if you have 'ComingsoonController.php' (with the
> lowercase 's') and the class is named 'ComingsoonController'?
> 
> 
> 
> Could anyone suggest any where I might start looking and debugging further? 
> Perhaps somewhere where the actual path to the action controller is generated
> and an attempt is made to instantiate the class might give me some clues as to
> what's going wrong?
> 
>  
> 
>  
> 
> 
> --
> 
>  
> 
> Simon Mundy | Director | PEPTOLAB
> 
>  
> 
> """ " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
> 
> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
> 
> Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
> 
> http://www.peptolab.com
> 
>  
> 
>  
> 
> Many thanks, 
> 
> ------------------
> 
> Greg Frith
> 
> DGFSolutions - Independent IT Consultancy, Troubleshooting and Development
> 
>  
> 
> [EMAIL PROTECTED] : +44 7970 925 257
> 
>  
> 
> MSN: [EMAIL PROTECTED]
> 
> Jabber: [EMAIL PROTECTED]
> 
> Skype: gregfrith
> 
>  
> 
>  
> 
> 
> 
>  
> 
>  
> 
> 
> --
> 
>  
> 
> Simon Mundy | Director | PEPTOLAB
> 
>  
> 
> """ " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
> 
> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
> 
> Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
> 
> http://www.peptolab.com
> 
>  
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to