Why preg_replace delete the " " in href?
Example
The normal link syntax is:
output instead rewrites:HTML Code:<a href="/mydir/mypag.html"> </ a>
How can you fix this error?HTML Code:<a href=mydir/mypag.html></ a>![]()
Why preg_replace delete the " " in href?
Example
The normal link syntax is:
output instead rewrites:HTML Code:<a href="/mydir/mypag.html"> </ a>
How can you fix this error?HTML Code:<a href=mydir/mypag.html></ a>![]()
Hi kikko1.
To fix your error, you'll probably need to either take out any double quotes from the pattern matching rule or possibly escape the double quotes.
To help you better though, it would help us a lot more if we could see the PHP code you are having problems with.
Hi Mike-XS
thank you for the reply.
Sorry, but the code php is translation script.
In short, the translation script calls the page to be translated, rewrites the translated page into the cache, but the output code does not adds the double quoted on all the tag <a href=.
I do not know which file generates the error:
- index.php
- translate.php
- tr_fixup.php
![]()
Ok.
This is the function that eliminates the url translate.google.
The file is:
tr_google.php
Sorry, I have only found out now that google is sending the tag attributes without the quotes.PHP Code:function GoogleFixupTagLinks($content)
{
//echo "GoogleFixupTagLinks called with: $content\n";
//FIXME: matching spaces may break things, but google is sending unquoted tag attributes...
$rstr = '|(http://.+?/translate_.*?)([ ">])|i';
$content = preg_replace_callback($rstr,'fix_link_cb',$content);
return $content;
}
But I think you can add quotes with a php function.
But I am not able to create it.
Maybe I am a nob or is it just that you can not do it?
I apologise for my bad english
Bookmarks