[support] asci and html question in Drupal

Jamie Holly hovercrafter at earthlink.net
Fri Apr 26 06:44:30 UTC 2013


That is an apostrophe. You can also do

$node->field_book_title['und']['0']['value'] = 
html_entity_decode($node->field_book_title['und']['0']['value']);

That will get any other HTML entites that might be hiding in there.

For the <br>:

$node->field_book_title['und']['0']['value'] = str_replace('<br>', "\n", 
$node->field_book_title['und']['0']['value']);

That's if you're sure all your <br> all the same. Better option:

$node->field_book_title['und']['0']['value'] = 
preg_replace('#<br\s*/?>#i', "\n", 
$node->field_book_title['und']['0']['value'] );

That get's all the variations (<br>, <BR>, <br />, etc.)

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net

On 4/25/2013 8:29 PM, Pia Oliver wrote:
> perhaps I copied the wrong instance; what I want to do is to replace 
> &#39;  with an apostrophe. Your response to me looks like it's a quote 
> mark? I mean a single quote mark/apostrophe like in "Pia's question"
>
> thanks,
>
> Pia
>
>> Metzler, David <mailto:metzlerd at evergreen.edu>
>> April 25, 2013 17:01
>> asci and html question in Drupal
>>
>> You're using the wrong escaping syntax for php. You could use \ but I 
>> find it easier to use single quotes like this:
>>
>> The double quote is surrounded by '  if you can't read it.
>>
>> _replace("&#39;",'"',$node->field_book_title['und']['0']['value']);
>>
>
> -- 
> Pia Oliver
>
> <http://www.piasworld.com>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130426/fa66dd05/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/support/attachments/20130426/fa66dd05/attachment.jpg 


More information about the support mailing list