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.

elapsed_time conditional

July 01, 2011 5:25pm

Subscribe [2]
  • #1 / Jul 01, 2011 5:25pm

    contactizm

    15 posts

    anyone have any idea why the code below isn’t acting the way it looks like it should?  i’d like to display 1 of three phrases based on the {elapsed_time} global variable.

    basically i want,
    0 - 0.2000 displays “(that’s fast)”
    0.2001 - 0.5000 displays “(that’s mediocre)”
    0.5000 + displays “(that’s kind of slow)”

    {elapsed_time} seconds to load page {if elapsed_time <= 0.2000} (that is fast){/if}{if elapsed_time > 0.2000 && elapsed_time <= 0.5000} (that is mediocre){/if}{if elapsed_time > 0.5000} (that is kind of slow){/if}

    i’ve tried doing it this way, i’ve tried using the if, elseif, else scheme ... none are working for me.  seems like this should work but i dunno.  i’m on ee1.6.9 Build:  20101018

    [Mod Edit: Moved to the Community Help forum]

  • #2 / Jul 04, 2011 3:22pm

    Wouter Vervloet

    758 posts

    I don’t think the conditionals can handle decimal values…

    Your best bet would be to use some PHP in the template or, event better, a simple plugin that handles it.

    Regards,
    Wouter

  • #3 / Jul 05, 2011 1:37pm

    contactizm

    15 posts

    thank you wouter, that’s what i needed to know.

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

ExpressionEngine News!

#eecms, #events, #releases