Friday, October 28, 2011

Re: Returning new value from private function

you probably mean "protected"
in a framework environment there is no reason to use private classes
or private variables.

tip:
look at 2.0
it does not have any private stuff (anymore).

protected _myMethod()

lg mark


On 28 Okt., 07:23, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> Calling a private function from app_controller into another controller ought to work. The only thing I can see from your pasted code is that all you are doing is calling the function (which is returning a value) but not collecting it. Try die(debug($this->__utfConvertChar($tempurl))); to see if it is indeed running.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 28 Oct 2011, at 03:49, MetZ wrote:
>
>
>
>
>
>
>
> > Hi all..
>
> > I am not sure if I am doing this correct, but I am trying to return a
> > private function from my app_controller.php to posts_controller.php
>
> > App_controller.php
>
> > function __utfConvertChar($tempurl) {
> >            $j = mb_strlen($tempurl);
> >            for ($k = 0; $k < mb_strlen($tempurl); $k++) {
> >            $char = mb_substr($tempurl, $k, 1);
> >                            if($this->__utfCharToNumber($char) == '195184' || $this-
> >> __utfCharToNumber($char) == '195152')
> >                            {
> >                            $newurl = str_replace($char,'o',$tempurl);
> >                            }
> >                            if($this->__utfCharToNumber($char) == '195165' || $this-
> >> __utfCharToNumber($char) == '195133' || $this-
> >> __utfCharToNumber($char) == '195164' || $this-
> >> __utfCharToNumber($char) == '195132')
> >                            {
> >                            $newurl = str_replace($char,'aa',$tempurl);
> >                            }
> >                            if($this->__utfCharToNumber($char) == '195188' || $this-
> >> __utfCharToNumber($char) == '195156')
> >                            {
> >                            $newurl = str_replace($char,'u',$tempurl);
> >                            }
> >            }
> >            return $newurl;
> >    }
> >    function __utfCharToNumber($char) {
> >            $i = 0;
> >            $number = '';
> >            while (isset($char{$i})) {
> >            $number.= ord($char{$i});
> >            ++$i;
> >            }
> >            return $number;
> >    }
>
> > Post_controller.php
> > $this->__utfConvertChar($tempurl);
>
> > Am I doing something wrong here? I can not see what.. Please assist
> > me, and/or let me know that this is not the best practice to do this.
>
> > Thanks all for any help!!!!
> > Regards!
> > -Tom
>
> > I am unable to retrieve the $newurl to my posts_controller.php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > 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

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: