[support] asci and html question in Drupal

Metzler, David metzlerd at evergreen.edu
Fri Apr 26 00:01:43 UTC 2013


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("'",'"',$node->field_book_title['und']['0']['value']);


________________________________
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On Behalf Of Pia Oliver
Sent: Thursday, April 25, 2013 3:58 PM
To: support at drupal.org
Subject: [support] asci and html question in Drupal

I changed the below from the lowest code with three quote marks to the immediate below with quote mark, apostrophe, quote mark; I wanted to have apostrophes in this field show properly on the website.  When I then uploaded this (part of a custom module) I got a php error and the site did not appear. I had to restore to a backup of the module.  My question is how do I get it to do what I want? Further, I need to change for the same filed "<br>" to a new line. I have text in there which is exported from a database and sometimes has <br> to create a new line in straight html.

   $node->field_book_title['und']['0']['value'] = str_replace("&#39;","'",$node->field_book_title['und']['0']['value']);

it used to be:
   $node->field_book_title['und']['0']['value'] = str_replace("&#39;","" ",$node->field_book_title['und']['0']['value']);


thanks,

Pia


--


www.piasworld.com

"But where is the ambiguity? It's over there, in a box." --J.Cleese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130426/9fe95632/attachment.html 


More information about the support mailing list