Skip to main content

Can CMS_INPUT_TEXTAREA parse CMS_REF values?

Comments

5 comments

  • Zendesk API User
    Author: MichaelaReydt - 3/3/2017 12:31

    Hello,

    I am not sure if I understand your scenario.

    You first describe the custom scripts before you mention your JS file. Do they have any context to each other?

    Could you show us the part of your code where you use the CMS_REF to link the JS file?

    Best regardsMichaela

    0
  • Zendesk API User
    Author: ldriver - 3/3/2017 15:21

    Hi Michaela, thanks for the reply.  I have a page template that has input for custom scripts:

    When we're building the pages to add a custom script on the page if needed.  The type for this is CMS_INPUT_TEXTAREA.

    I was wondering if there was a way to do this in that field:

    <script type="text/javascript" src="$CMS_REF(media:"script")$"></script>

    Right now, it seems that the CMS_REF won't parse, it shows up as the literal string $CMS_REF(media:"script")$, and I need to move it (for now) to the output channel in the HTML, which is not ideal because then all pages created with this template with include the script, where I only want it include where it's added in custom page scripts.  Is there something I can do to get that work, or another technique?

    0
  • Zendesk API User
    Author: pavone - 3/7/2017 10:40

    Hi,

    I don't think this is possible. But probably you could alter your form for this use case a little bit. You could give the editor the option to enter script code in the CMS_TEXT_AREA and to select script files from the media store that should be included using a FS_REFERENCE. That way you wouldn't have to parse the text in the text area.

    Hope that helps.

    Regards

    Tim

    0
  • Zendesk API User
    Author: ldriver - 3/7/2017 12:44

    Thanks for the reply.  Good idea, that solves my problem and is simple.

    0
  • Zendesk API User
    Author: thomas_ritter - 3/11/2017 14:16

    Why not use "stTextArea.parse" ??? Then all text in the area will be parsed. I think that is what you want.

    0

Please sign in to leave a comment.