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.

Plugin being parsed before IF..THEN statement

January 04, 2010 9:30am

Subscribe [3]
  • #1 / Jan 04, 2010 9:30am

    Stuart Whitman

    27 posts

    I have the following code as an include with PHP enabled on output but am having problems with the plugin being processed twice and throwing errors. It seems that the imgsizer plugin is parsed before the IF..THEN statement.

    {assign_variable:my_template_group="car-leasing-contract-hire"}
                            <div class="grid-row">
        {exp:weblog:entries weblog="offers" site="plancars" disable="categories|member_data|pagination|trackbacks" sort="asc" orderby="offers_payment" show_expired="no" show_future_entries="no" rdf="off"  {if embed:max_offers}limit="{embed:max_offers}"{/if}  dynamic="off"  {if embed:entry_id}entry_id="{embed:entry_id}"{/if} status="{embed:the_status}" {if embed:cat_id}category="{embed:cat_id}"{/if} }
                                <div class="grid-item {switch='one|two|three'}">
                                    <div class="grid-image">
                                        <a href="http://{url_title_path={my_template_group}/vehicle}">_                                        {if offers_image}_                                            {exp:imgsizer:size src="{offers_image}" width="167" quality="90" alt="{title}"}_                                        {if:else}_                                            {related_entries id="offers_car"}_                                                    {exp:imgsizer:size src="/images/cap/{imagefile}" width="167" quality="90" alt="{make} {lmodel}"}_                                            {/related_entries}_                                        {/if}_                                    </a>
                                    </div>                    
                                    <div class="grid-copy">
                                        <a href="http://{url_title_path={my_template_group}/vehicle}" class="gridtitle">{title}_</a>
                                            <a href="http://{url_title_path={my_template_group}/vehicle}" class="gridco2">{related_entries id="offers_car"}CO2 {co2} g/km » Eco Band {if co2<=100}A{if:elseif co2>100 AND co2<=120}B{if:elseif co2>120 AND co2<=150}C{if:elseif co2>150 AND co2<=165}D{if:elseif co2>165 AND co2<=185}E{if:elseif co2>185 AND co2<=225}F{if:else}G{/if}{/related_entries}_</a>
                                        <a href="http://{url_title_path={my_template_group}/vehicle}" class="gridprice">£{offers_payment}</a> per month
    
                                    </div>
                                    <div class="clear"><!----></div>
                                </div>
                                                           <?php if (fmod({count},3)  == 0 && {count} != {total_results}) { ?></div>{if count == 6 }{embed="includes/newsletter" }{/if}<div class="grid-row"><?php } ?> 
        {/exp:weblog:entries}
                               </div>

    Is this correct behaviour and what alternatives have I got as I can’t seem to find a way around this?

    EE 1.6.8 with MSM.

    Stuart

  • #2 / Jan 04, 2010 5:06pm

    Ingmar

    29245 posts

    It seems that the imgsizer plugin is parsed before the IF..THEN statement.

    Yes, advanced conditionals are processed regardless of the comparison, which only determines whether the clause is displayed, or not.

    Is this correct behaviour and what alternatives have I got as I can’t seem to find a way around this?

    Try simple conditionals, or embedded templates.

  • #3 / Jan 05, 2010 5:25am

    Stuart Whitman

    27 posts

    Thanks Ingmar, Doing embeds has sorted it - should have thought of that earlier.

  • #4 / Jan 05, 2010 7:48am

    Sue Crocker

    26054 posts

    Glad Ingmar was able to help. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases