ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Nested if statement not working

June 13, 2008 5:36pm

Subscribe [2]
  • #1 / Jun 13, 2008 5:36pm

    textdriven

    107 posts

    I tried this…

    {if news_video}
    <div id="video_full"><a href="http://www.adobe.com/products/flashplayer/">Get the Flash Player</a> to see this video.</div>
    
    
    
        var s0 = new SWFObject("/media/mediaplayer.swf","mediaplayer","431","320","8");
        s0.addParam("allowfullscreen","true");
        s0.addVariable("width","431");
        s0.addVariable("height","320");
            {related_entries id="news_image"}
        s0.addVariable("image","{medium_url}");
            {/related_entries}
        s0.addVariable("file","http://media.mysite.net/{news_video}.flv");
        s0.addVariable("link","http://media.mysite.net/{news_video}.m4v");
    {if news_video_captions} s0.addVariable("captions","/files/{news_video_captions}"); {/if}
        s0.addVariable('showdownload','true');
        s0.addVariable('linktarget','_self');    
        s0.write("video_full");
    
    {/if}

    and it outputs this…

    <div id="video_full"><a href="http://www.adobe.com/products/flashplayer/">Get the Flash Player</a> to see this video.</div>
    
    
    
        var s0 = new SWFObject("/media/mediaplayer.swf","mediaplayer","431","320","8");
        s0.addParam("allowfullscreen","true");
        s0.addVariable("width","431");
        s0.addVariable("height","320");
            
        s0.addVariable("image","http://images.mysite.org/primary/1161_medium.jpg");
            
        s0.addVariable("file","http://media.mysite.net/video.flv");
        s0.addVariable("link","http://media.mysite.net/video.m4v");
    {if "not"} s0.addVariable("captions","/files/not"); {/if}
        s0.addVariable('showdownload','true');
        s0.addVariable('linktarget','_self');    
        s0.write("video_full");
  • #2 / Jun 13, 2008 7:20pm

    ROCKET MEDIA

    153 posts

    It looks like you dont have any tags telling the page you are using javascript.
    You do have {exp:weblog:entries} tags around all that, right?

    Just for kicks, try this instead:

    {if news_video_captions != ''}{/if}
  • #3 / Jun 14, 2008 10:10am

    textdriven

    107 posts

    Moderator’s note: Merged—please do not double post.

    I tried this…

    {exp:weblog:entries weblog="news" username="{country_code}" limit="1" disable="member_data|pagination|trackbacks" status="open"}
    <h1>{title}</h1>
    {if news_video}
    <div id="video_full"><a href="http://www.adobe.com/products/flashplayer/">Get the Flash Player</a> to see this video.</div>
    
    
    
        var s0 = new SWFObject("/media/mediaplayer.swf","mediaplayer","431","320","8");
        s0.addParam("allowfullscreen","true");
        s0.addVariable("width","431");
        s0.addVariable("height","320");
            {related_entries id="news_image"}
        s0.addVariable("image","{medium_url}");
            {/related_entries}
        s0.addVariable("file","http://media.mysite.net/{news_video}.flv");
        s0.addVariable("link","http://media.mysite.net/{news_video}.m4v");
    {if news_video_captions} s0.addVariable("captions","/files/{news_video_captions}"); {/if}
        s0.addVariable('showdownload','true');
        s0.addVariable('linktarget','_self');    
        s0.write("video_full");
    
    {/if}
    {/exp:weblog:entries}

    and it outputs this…

    {exp:weblog:entries weblog="news" username="{country_code}" limit="1" disable="member_data|pagination|trackbacks" status="open"}
    <h1>My title</h1>
    
    <div id="video_full"><a href="http://www.adobe.com/products/flashplayer/">Get the Flash Player</a> to see this video.</div>
    
    
    
        var s0 = new SWFObject("/media/mediaplayer.swf","mediaplayer","431","320","8");
        s0.addParam("allowfullscreen","true");
        s0.addVariable("width","431");
        s0.addVariable("height","320");
            
        s0.addVariable("image","http://images.mysite.org/primary/1161_medium.jpg");
            
        s0.addVariable("file","http://media.mysite.net/video.flv");
        s0.addVariable("link","http://media.mysite.net/video.m4v");
    {if "not"} s0.addVariable("captions","/files/not"); {/if}
        s0.addVariable('showdownload','true');
        s0.addVariable('linktarget','_self');    
        s0.write("video_full");
    {/exp:weblog:entries}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases