if statements not executing in javascript tag
Posted: 27 June 2008 10:46 AM   [ Ignore ]  
Summer Student
Total Posts:  6
Joined  01-22-2008

this is so weird. i can’t figure it out! here’s a snippet of my code.

{exp:weblog:entries weblog="case_studies" limit="1" disable="member_data|trackbacks|pagination" dynamic="on"}

{if cs_ss_image2
|| cs_ss_image3 || cs_ss_image4 || cs_ss_image5 }
< script type="text/javascript" language="javascript" >

doclay = (document.layers)? true : false
docall
= (document.all)? true : false
docget
= (document.getElementById)? true : false

thisImg
= 0
{if cs_ss_image2
&& cs_ss_image3 && cs_ss_image4 && cs_ss_image5 }
imgCt
= 4
{if
:elseif (cs_ss_image2 && cs_ss_image3 && cs_ss_image4) && (cs_ss_image5 == "")}
imgCt
= 3
{if
:elseif (cs_ss_image2 && cs_ss_image3) && (cs_ss_image4 == "") && (cs_ss_image5 == "")}
imgCt
= 2
{if
:elseif cs_ss_image2 && (cs_ss_image3 == "") && (cs_ss_image4 == "") && (cs_ss_image5 == "")}
imgCt
= 1
{if
:else}
imgCt
= 0
{
/if}
baseCt
= 0

....

< /
script >
{/if}

there are other if statements in the javascript code too but i cut them out for brevity. when i look at the source of my page, the if statements with the rendered custom field variables are dumping to the html. they aren’t rendered. BUT if statements outside of the

< script type="text/javascript" language="javascript" >

tag render fine! if i delete the

< script type="text/javascript" language="javascript" >

tag the if statements are rendered. why would this

< script type="text/javascript" language="javascript" >

be causing if statements not to render? i’m so stumped.

BTW, this is an article page so dynamic is turned on so that exp:weblog:entries grabs the proper content.

p.s. spaces in the javascript tags are there because the forum removed the tags otherwise.

Profile
 
 
Posted: 27 June 2008 10:56 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  6
Joined  01-22-2008

oh my god, i found the answer by hitting google with 10 different queries.

http://expressionengine.com/wiki/Hidden_Configuration_Variables/#protect_javascript

you know, i can’t help but think that this should be turned off automatically or it should be documented up front in the “getting started” tutorial.

i guess you can close this one smile

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62610 Total Logged-in Users: 13
Total Topics: 77108 Total Anonymous Users: 12
Total Replies: 416361 Total Guests: 122
Total Posts: 493469    
Members ( View Memberlist )
Newest Members:  redarcEbbyWolfCIfan1000grayskwrlcornernotetriplexwengbaoshanGenki1gabewellsGlauco