ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Can I escape entry tag output?

October 21, 2010 4:57pm

Subscribe [2]
  • #1 / Oct 21, 2010 4:57pm

    Michael Witwicki

    115 posts

    This might sound like a silly question - but for what I am trying to do, I really need to assign my channel fields to PHP variables to work. So I have something like:

    <?php
    {exp:channel:entries limit="1"}
       $myField = "{my_field}";
    {/exp:channel:entries}
    ?>

    However, whenever someone enters a field with double-quotes, it breaks the page. Is there a way to escape template tage output on the way out?

  • #2 / Oct 21, 2010 6:49pm

    Michael Witwicki

    115 posts

    Looks like I found my answer here: http://ellislab.com/forums/viewthread/79541/#752057

  • #3 / Oct 21, 2010 7:17pm

    Jamie Poitra

    409 posts

    You can also user the HEREDOC method.

    {exp:channel:entries limit="1"}
    $myField = <<<CODE
    {my_field}
    CODE;
    {/exp:channel:entries}

    Jamie

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases