Saturday, May 2, 2009

Re: Telling PHP to put "&" NOT "&"

If you posted exact code for restore_html_ecoded_characters this
function do nothing on array values. In foreach($pArray as $key =>
$value) variable $value contains copy of value but not reference to
it. On is_array($value) you need to call restore_html_ecoded_characters
($pArray[$key]); as you do for non-array values.

On May 3, 8:17 am, rartavia <royarta...@gmail.com> wrote:
> Here is the code by the way...
>
> function restore_html_ecoded_characters(&$pArray){
>         foreach($pArray as $key => $value){
>                 if(is_array($value)){
>                         restore_html_ecoded_characters($value);
>                 }else{
>                         $pArray[$key] = str_replace("_#", "&#", $value);
>                 }
>         }}
>
> In Controller:
>
> function save(){
>         $this->layout = null;
>
>         $thisdata = $this->data;
>         restore_html_ecoded_characters($thisdata);
> ...
>         $this->Denouncement->saveAll($thisdata);
> ...
>
> Is there any weird thing to know about when trying to edit $this->data?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

No comments: