if conditional not parsing w/in script tags
Posted: 12 September 2008 10:50 AM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

The if conditional parses correctly outside of the script tags, but not within.  Why would EE care?

Page:
removed
I realize the player isn’t linking up, but I just want to show the conditional in the source

Code:
I’ve included the whole page here, in this entry, there is an av_audio_filename, but not an av_video_filename

{doctype}
<head>
<
title>MySite | {exp:weblog:entries weblog="audiovideo" limit="1"}  {title}</title>
{meta_general}
{link}
</head>
<
body>


{embed="page_elements/header"}


<div id="wrapper">
<
div id="content_int">
<
div  id="static">
<
h1>{title} {if member_group == '1'} <a href="/mysystem/index.php?C=edit&M=edit_entry&weblog;_id={weblog_id}&entry;_id={entry_id}" title="Edit Entry" target="_blank"><span style="font: 10px verdana, sans-serif; text-transform: uppercase; color: #900;">Edit This</span></a>{/if}</h1>


    <
div id="av_container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
    
[removed][removed]
    [removed]
        
var s1 = new SWFObject("http://www.mydomain.org/jwplayer/player.swf","ply","328","200","9","#FFFFFF");
        
s1.addParam("allowfullscreen","true");
        
s1.addParam("allowscriptaccess","always");
{if av_audio_filename}
        s1
.addParam("flashvars","file=http://www.mydomain.org/audio/{av_audio_filename}");
{/if}
{if av_video_filename}
        s1
.addParam("flashvars","file=http://www.mydomain.org/video/{av_video_filename}");
{/if}
        s1
.write("av_container");
    
[removed]

{
/exp:weblog:entries}


{if av_audio_filename}
        The conditional works outside of the script tags
.
{/if}

</div>
</
div>
</
div>
<
div id="navigation">
{embed="page_elements/left_sidebar"}
</div>

{footer}
</div>
</
div>
</
body>
</
html>

Thanks for your help!

Profile
 
 
Posted: 12 September 2008 10:53 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

In my source, quotes are inserted around the custom field name.  So weird.

{if "BobPyleFinal2-13-08.mp3"}
        s1
.addParam("flashvars","file=http://www.mydomain.org/audio/BobPyleFinal2-13-08.mp3");
{/if}
{if
""}
        s1
.addParam("flashvars","file=http://www.mydomain.org/video/");
{/if}

Profile
 
 
Posted: 12 September 2008 03:32 PM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

In config.php, do you have protect_javascript as a config variable? If so, what is it set to?

And what version and build of EE are you on?

 Signature 
Profile
MSG
 
 
Posted: 13 September 2008 06:25 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

I don’t have protect_javascript as a config variable

EE is 1.6.2 Build:  20080206

Profile
 
 
Posted: 14 September 2008 09:36 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

It’s a hidden config so just try adding it to your config.php

$conf['protect_javascript'] = 'y';


Does that help?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 14 September 2008 09:48 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

I’ve added it but am getting the same result.

Profile
 
 
Posted: 14 September 2008 09:57 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

In ‘Admin- System Prefs- Output and Debug’ do you have ‘show php errors’ set to show for admins?  If not- flip it on.  Any difference?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 14 September 2008 10:06 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

It was already on, it’s not showing any errors.

Profile
 
 
Posted: 14 September 2008 11:09 AM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

Hm- can you setup a test template w/only the key bits on it?  Let’s see what happens there.  And if it still jams up- which I expect it will- can you put it in a text file, zip it up and attach it?  I want to try some replication.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 14 September 2008 12:50 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

Hi Robin,

Here’s a test screen.

I added a member group conditional for kicks, it’s behaving similarly bizarre.

Template attached.

File Attachments
test.txt.zip  (File Size: 1KB - Downloads: 13)
Profile
 
 
Posted: 14 September 2008 12:54 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

Hey Robin, seems if I set the config variable mentioned previously to ‘n’, this fixes.  Does that make sense?  Any danger in doing that?  I don’t really understand what it’s doing from the wiki explanation.

Profile
 
 
Posted: 15 September 2008 09:47 AM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

Hm- it doesn’t make sense to me, mostly because I’m pretty sure default is no.  Do a quick search in the config.php- any chance that variable is in there twice?  Could be it was already on and you just turned it off.

And- what version/build?  I want to go double check that it defaults to ‘no’ if it’s not in there.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 15 September 2008 12:12 PM   [ Ignore ]   [ # 12 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

It’s definitely not in the config file twice.  This site is on EE 1.6.2 Build: 20080206

Profile
 
 
Posted: 15 September 2008 12:28 PM   [ Ignore ]   [ # 13 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

I can’t promise this will take care of the issue, but you definitely should upgrade to EE 1.6.4. We recommend it for security reasons.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 06 October 2008 07:23 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

FYI, I’m finding this same problem on a 1.6.4 site.

Profile
 
 
Posted: 07 October 2008 08:34 AM   [ Ignore ]   [ # 15 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

I’d have sworn protect_javascript was off by default, but clearly I’m wrong.  In core.templates.php it’s specified at the top:

var $protect_javascript =  TRUE;        // Protect javascript in conditionals


Then it checks for the hidden config later on:

/* ---------------------------------
        /*    Hidden Configuration Variables
        /*  - protect_javascript => Prevents advanced conditional parser from processing anything in [removed] tags
        /* ---------------------------------*/
            
        
if ($PREFS->ini('protect_javascript') == 'n')
        
{
            $this
->protect_javascript = FALSE;
        
}


Since you needed the conditionals- you had to manually turn it off.  Seems to me the docs might want to make that a big more clear.

But in any case- does that make sense of what’s going on?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 07 October 2008 08:38 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

Sure thing Robin.  Thanks.  I know what to do now, I was just posting for the next weary traveler smile

Profile
 
 
Posted: 07 October 2008 08:50 AM   [ Ignore ]   [ # 17 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

wink  Appreciate it, ruraldreams.  I was confused as well- thought it defaulted to unprotected!

 Signature 

AKA rob1

Help Request TipsPro Network

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 09:33 AM
Total Registered Members: 64912 Total Logged-in Users: 24
Total Topics: 81863 Total Anonymous Users: 16
Total Replies: 440100 Total Guests: 207
Total Posts: 521963    
Members ( View Memberlist )
Newest Members:  bjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkeybenekwhobutsb