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.

Subtract {two_date} - {variables}

March 31, 2012 7:31pm

Subscribe [3]
  • #1 / Mar 31, 2012 7:31pm

    FCWebTeam

    4 posts

    How can I subtract/add/multiple/etc… template variables? All of the addons I see don’t specifically show examples with template variables.

    I tried something as simple as (with php in templates enabled):

    <?php echo (int) "{event_start_date}" - (int) "{event_pre_event_duration}" ?>

    It just returns {event_start_date}.

  • #2 / Mar 31, 2012 9:23pm

    LMO

    203 posts

    hi

    i got out to work without quotes.

    <?php echo {number} - {number2}; ?>

  • #3 / Mar 31, 2012 9:31pm

    FCWebTeam

    4 posts

    When I try that I end up with

    Parse error: syntax error, unexpected '<' in /expressionengine/libraries/Functions.php(656) : eval()'d code on line 4

    I’m going to take it out of the embed and see if that does anything.

  • #4 / Mar 31, 2012 9:41pm

    FCWebTeam

    4 posts

    Ah crud I figured it out by debugging the Function.php. Fieldtype was set to xhtml so I was getting 0.

  • #5 / Apr 02, 2012 12:48pm

    Shane Eckert

    7174 posts

    Hey FCWebTeam,

    I am glad that VIM could help you out here.

    Nice work guys.

    Have a great week.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases