I'm working with a site that's based on some custom templating system. Let's say that in a template I can use tag [custom_text] which will output the entire block of html like this, defined through the CMS's rich text editor:
<b>Lorem ipsum dolor</b> sit amet, "consectetur adipisicing elit"<br /><br />
<b>sed doeiusmod</b> tempor incididunt ut's labore et dolore magna's aliqua.
Please note that it contains both types of quotes in it. I am not able to preprocess anything that comes out of the templating system other than actually outputting it to the page, as the CMS with templating system is encoded.
Now I actually need to manipulate that block, for instance to remove all the line breaks from the code. I can use php on the page, but I cannot define a string that would contain that block of code. If I do it either way:
$string = "[custom_text]";
$string = '[custom_text]';
the quotes in the block will come in the way, ending the string prematurely. Is there any obvious way to handle this issue?
Don't know why I haven't thought of this before, but I can simply use the heredoc syntax.
$string = <<<EOT
[custom_text]
EOT;
will solve the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With