Sunday, May 3, 2009

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

Hello guys, thanks for your answers.

As I supposed, it was the debugger::log() function the one converting
'&' into amp, the real problem was in Dr. Loboto's (thanks man)
observation about the reference parameter. After correcting it, I got
in my DB "&#NUMBER;" no need for more, here is the correction:

function restore_html_ecoded_characters(&$pArray){
foreach($pArray as $key => $value){
if(is_array($value)){
restore_html_ecoded_characters($pArray[$key]);
}else{
$pArray[$key] = str_replace("_#", "&#", $value);
}
}
}

Lapinski: About your suggestion, I like it for entities as áéíóú but
what about the ampersand? I'm sending via ajax something like this:
jQuery.ajax({
data:"data[Model][attribute]=value1&data[Model][attribute2]=value2&data
[Model][attribute]=value3&...",
...otherAjaxOptions...
});
some of my values contain '&' which would, for cake divide the
parameter value,
IE: "data[Model][url]=<object...value="http://somepage.com/
example&hl=en&fs=1
">...</object>&..."
in controller, when I read data["Model"]["url"] would be
"<object...value="http://somepage.com/example" ignoring the rest since
the ampersand is the parameter separator. For the rest, for sure i'll
use php's htmlentities, that way is less processing in JavaScript,
thanks
--~--~---------~--~----~------------~-------~--~----~
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: