Friday, August 27, 2010

Re: What's about the double underscore in front of methods?

Thank you for the information, guys.

By the way, is there an option so that Google Groups sends me answers
to my topics to my Gmail address?

On 27 Aug., 11:32, nurvzy <nur...@gmail.com> wrote:
> Hmm, I actually thought the idea behind the underscores was to provide
> a sudo protected/private flags for PHP4.  One underscore means
> protected, two means private.  While there is nothing in PHP4 that
> prohibiting one to use a function with __ or _ prefix, it is
> universally frowned upon as you're implementing a function that was
> not intended to be utilized outside its own instance/hierarchy.
>
> The exception to this rule as far as I know in CakePHP is the __()
> function which is a translation function that auto-echos by default.
>
> I imagine Jeremy is right in this case, __getPageTitle is probably a
> custom function defined for translation purposes that leverages the
> __() function.
>
> Nick
>
> On Aug 27, 2:42 am, Jeremy Burns | Class Outfit
>
> <jeremybu...@classoutfit.com> wrote:
> > It's used in localisation - it basically looks to see if you have defined a translated version of the contents of the brackets. Seehttp://book.cakephp.org/view/1229/Internationalizing-Your-Application.
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > On 27 Aug 2010, at 09:31, psybear83 wrote:
>
> > > Hi everybody
>
> > > I stumbled over some methods in a CakePHP app I've taken over from
> > > somebody that begin with a double underscoore, e.g.:
>
> > > __getPageTitle(...)
>
> > > I'm not sure what's the philosophy about that? I know one underscore
> > > as the convention for private methods, but two underscores?
>
> > > Thanks a lot for informations.
> > > Joshua
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions.
>
> > > 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+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate