What is the best practice for manipulating strings with PHP (output mode) that might contain straight quote marks (single or double)? I'm not totally clear how EE stores and outputs these normally, and so I've run into PHP parse errors in certain situations.
Is the only reliable method to use {exp:xml_encode}
? For example:
$excerpt = '{exp:xml_encode}{post_excerpt}{/exp:xml_encode}';
...and are those single quotes above around the EE code better than using double quotes?
EE's implementation of {exp:xml_encode}
incorporates the PHP strip_tags() function, so this is not always ideal (e.g the excerpt above might have a phrase wrapped in <strong>
tags. But at the same time, it seems there's no other way to store and manipulate the field content in PHP if it contains single or double quotes.