Placeholder content does not render in Source mode

Topics: General, Troubleshooting
May 1, 2011 at 9:32 PM

Hi,

I created a placeholder in my template named HeaderScript. My goal was to put page-specific script into that placeholder.

When I put the following into the placeholder, the page renders properly. However, when I edit the page, go to the Content tab, click on the HeaderScript placeholder, and switch to Source view, I do not see any of my script. Following is the Source view when I first enter it:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head></head>
  <body>
    <script type="text/javascript" src="/frontend/scripts/fadeslideshow.js">
      /***********************************************
      * Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
      * This notice MUST stay intact for legal use
      * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
      ***********************************************/
    </script>
   
    <script type="text/javascript">
      var getSocialGallery = new fadeSlideShow({
        wrapperid: "fadeshow", //ID of blank DIV on page to house Slideshow
        dimensions: [173, 131], //width/height of gallery in pixels. Should reflect dimensions of largest image
        imagearray: [
        ["/frontend/images/barzhini-logo.jpg"],
        ["/frontend/images/getsocial1.jpg", "", "", "Get Social 2010"],
        ["/frontend/images/getsocial2.jpg", "", "", "Get Social 2010"],
        ["/frontend/images/getsocial3.jpg", "", "", "Get Social 2010"],
        ["/frontend/images/getsocial4.jpg", "", "", "Get Social 2010"] // no trailing comma after very last image element!
      ],
        displaymode: { type: 'auto', pause: 2500, cycles: 0, wraparound: false },
        persist: false, //remember last viewed slide and recall within same session?
        fadeduration: 500, //transition duration (milliseconds)
        descreveal: "ondemand",
        togglerid: ""
      })
    </script>
  </body>
</html>

Then if I save, publish, and look at it again, it is now reset to the following:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head></head>
  <body></body>
</html>


How do I diagnose this problem?

Sean

May 2, 2011 at 11:24 AM
Edited May 2, 2011 at 11:25 AM

Try to put your script inside the script-tags in CDATA comments like this

<script type="text/javascript">
/* <![CDATA[ */
// content of your Javascript goes here
/* ]]> */
</script>

or just without the comments since all new browsers should understand this syntax

<script type="text/javascript">
<![CDATA[
// content of your Javascript goes here
]]>
</script>

May 11, 2011 at 3:11 AM

Thanks for the suggestion. Unfortunately, neither option affects what happens. I'll dig into some more down the road.