Support » Themes and Templates » Cool script behaves oddly on pages, and perfectly in template.

  • Resolved 4evrblu


    OK this is a real odd one.

    On my site I am making use of an old script I have lying around that does two things:

    It automatically cycles one of seven images [monday.gif, tuesday.gif etc] each day of the week beginning at midnight, so that the images automatically update each night.

    Also, it links each image to a PHP file that has information on that product (I am in the middle of revamping the pages for the products, so the links are bogus at the moment, but that is not relevant to the issue).

    The script eventually will reside on my product Spotlight page located at the top of my blog, located here:

    I also use a test template to try things out and The Template is here:

    As you can plainly see in the above link, the script is working fine on test-template.shtml

    I tried posting the script here, but it goofed up the post so I cannot post it here. You can check the code in the source of the template file

    Take my word for it, the script is simple and seems to work just peachy in the template

    However, on the actual SPOTLIGHT page, EVERYTHING, and I do mean everything, goes completely nuts, with the sidebar and delicious links showing up willy nilly all over the place and the script not showing up anywere.

    I added the script to my Spotlight page in the manage page area of Admin.

    I just pasted it in the form field and submitted it.

    Aside from a few lines of text, the script is all that is in the field. I have tried it by removing any text, and the result it the same.

    I hit submit, and boom, the rest is mystery. The whole page blows up. Part of the sidebar is inclosed in the entry box, the rest is shoved beneath it.

    What gives? Why would it work in the template but not in the Spotlight page, where I want it to be?

    Help me ASAP please:)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Have you tried disabling the RTE and then cutting and pasting the script in? Also, from what app are you doing the cutting and pasting?

    Hi Ryan. I use Safari to do most of the editing and Safari does not use the RTE. Therefore the structure of the script is preserved. And remember, it works in the template, which I built with Web Design 2.8, and teh script is copied from there.

    here is the script


    today = new Date();
    day = today.getDay();
    arday = new Array("", "", "",
    "", "", "", "");

    arURL = new Array("sunday.php", "monday.php", "tuesday.php",
    "wednesday.php", "thursday.php", "friday.php", "saturday.php");

    document.write("<a href='" + arURL[day] + "'><img src='" + arday[day] + "' border='0'></a>");


    [moderated: Look right below the text editor here for instructions on how to handle pasting code. Hint – Backticks!]

    Thanks for the tip Moderator 🙂

    Now, for a solutution? Anyone?

    [It wasn’t me who moderated the code, but if you didn’t put the backticks from the beginning, when you post it first time it gets screwed… usually half of it is gone]

    Anyway, since on your example (test) page above it shows as a JS – you shuold start here:

    OK so if my understanding is correct, I create jar file with my script in it and load it in the metatags with a link like this:

    <script type=”text/javascript” src=””>

    then, I go to the page I want to call it in (Spotlight) and I insert

    <script type=”text/javascript”>

    into the text area?

    Well this may not be what the article was saying do, but I tried it anyway, and it did not work.


    I really think this is the solution, I just did not execute it correctly.

    Since the above solution did not work, I stumbled across this by accident.

    I wanted to see what would happened if I took the JS cal out of meta tags and put in directly into the Spotlight page itself, like so:

    <p>Stay tuned for developments.
    <script type=”text/javascript” src=””></script></p>

    It should not have worked, but it DID!

    I was shocked.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cool script behaves oddly on pages, and perfectly in template.’ is closed to new replies.