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.

If conditional within an if conditional..

July 25, 2011 3:15pm

Subscribe [7]
  • #1 / Jul 25, 2011 3:15pm

    Etheya

    213 posts

    Not sure whats going on here.. but this has been working fine for several months, ( unless that was just luck ) but for some reason or other this code is now not working..

    {categories}
                    {if category_id == "6" OR category_id == "7"}
    
                        {if print-orientation == "Portrait"}
                        <div class="printimage fp">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxHeight="360" alt="{title}"}</a>
                        </div>                
                        
                        {if:elseif print-orientation == "Landscape"}
                        <div class="printimage">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
                                        
                    {/if}
                    {/categories}

    its just throwing out

    {categories} {/categories}

    on the front end.. yet has been working nicely up to that point..

  • #2 / Jul 25, 2011 4:45pm

    Etheya

    213 posts

    Did something change from 2.1.3 to 2.2.1 with this at all?

  • #3 / Jul 25, 2011 4:47pm

    Try getting rid of the advanced conditional and use two simple ones instead. They tend to bug up if you nest the advanced ones 😊

    /Rasmus

  • #4 / Jul 25, 2011 5:07pm

    Etheya

    213 posts

    Yeah i had 2 simple ones to begin with.. which used to work… hence why im wondering if something changed with the version of ee from 2.1.3 to 2.2.1 ?

    this used to work as simple conditional..

    {categories}
                    {if category_id == "6" OR category_id == "7"}
    
                        {if print-orientation == "Portrait"}
                        <div class="printimage fp">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxHeight="360" alt="{title}"}</a>
                        </div>                                    
                        {/if}
    
                        {if print-orientation == "Landscape"}
                        <div class="printimage">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>                    
                        {/if}
                                        
                    {/if}
                    {/categories}

    But seems to have stopped…

  • #5 / Jul 25, 2011 5:13pm

    And you are able to print something from within the first conditional?

  • #6 / Jul 25, 2011 5:16pm

    Etheya

    213 posts

    Ah its not printing anything.. its displaying a print… dependant on if orientation…

    if i just use

    {categories}
                    {if category_id == "6" OR category_id == "7" }
    
    
                        <div class="printimage fp">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxHeight="360" alt="{title}"}</a>
                        </div>                                    
                                        
                    {/if}
                    {/categories}

    then it displays fine.. but its not checking the orientation of this particular entry… which is what it was doing..

  • #7 / Jul 25, 2011 5:30pm

    Etheya

    213 posts

    Something has defo changed… any EE tech around to confirm or not?

  • #8 / Jul 25, 2011 5:40pm

    Etheya

    213 posts

    This was bugging me that much.. that in the end ive rolled back to 2.1.3 and it works again… so something is going astray or has changed between the 2 versions…

  • #9 / Jul 25, 2011 5:47pm

    So it’s actually the orientation variable that doesnt work?

  • #10 / Jul 25, 2011 5:56pm

    Etheya

    213 posts

    Well more than that i think, ive rolled EE back to 2.1.3 on a test server and it all works again nicely… its something thats changed with EE 2.2.1 .... parsing has changed or something. Hoping one of the EE tech guys comes along soon

  • #11 / Jul 25, 2011 6:04pm

    They usually take 24 hours to answer 😊

  • #12 / Jul 25, 2011 7:00pm

    Etheya

    213 posts

    Have now reuploaded with a new copy of the files from 2.2.1 and now dont get some of the errors.. but its still not parsing correctly…

  • #13 / Jul 25, 2011 7:03pm

    Ethya what do you get when you try to output the variables you use in your conditionals? Sometimes I’ve had luck doing like this:

    {if "{variable}” == “whatever”}

    Instead of {if variable == "whatever"}

    Give it a try.

  • #14 / Jul 25, 2011 7:11pm

    Etheya

    213 posts

    YEah have tried that..

    {categories}
                 
                    {if "{category_id}" == "6" OR "{category_id}" == "7"}
    
                        {if print-orientation == "Portrait"}
                        <div class="printimage fp">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxHeight="360" alt="{title}"}</a>
                        </div>                
                        {/if}                
        
                        {if print-orientation == "Landscape"}
                        <div class="printimage">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
        
                        {if print-orientation == "Panoramic"}
                        <div class="printimage pan">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
        
                        {if print-orientation == "Panoramic Thin"}
                        <div class="printimage panthin">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
        
                        {if print-orientation == "Panoramic Small"}
                        <div class="printimage pansmall">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
        
                        {if print-orientation == "Panoramic Deep"}
                        <div class="printimage pandeep">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
        
                        {if print-orientation == "Panoramic Deepest"}
                        <div class="printimage pandeepest">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxWidth="360" alt="{title}"}</a>
                        </div>
                        {/if}
        
        
                        {if print-orientation == "Square"}
                        <div class="printimage squ">
                            <a href="http://{print-img}%22rel=%22example_group" rel="example_group" title="{title}">{exp:ed_imageresizer image="{print-img}" default="" maxHeight="280" alt="{title}"}</a>
                        </div>
                        {/if}
                    
                    {/if}
                    {/categories}

    with no luck..

  • #15 / Jul 25, 2011 7:18pm

    So it is actually the category_id conditional that does not work? That makes no sense since I know it is working on my system and I have the same build. Have your tried outputting the category_id so that you can see what Expression Engine thinks it is in the situation? Maybe something messed up there.

    /Rasmus

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases