Ignore:
Timestamp:
Jun 14, 2014, 4:15:05 PM (10 years ago)
Author:
mistic100
Message:

add dark selectize theme + "ternary" template modifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r28600 r28703  
    122122    $this->smarty->registerPlugin('modifiercompiler', 'translate_dec', array('Template', 'modcompiler_translate_dec') );
    123123    $this->smarty->registerPlugin('modifier', 'explode', array('Template', 'mod_explode') );
     124    $this->smarty->registerPlugin('modifier', 'ternary', array('Template', 'mod_ternary') );
    124125    $this->smarty->registerPlugin('modifier', 'get_extent', array($this, 'get_extent') );
    125126    $this->smarty->registerPlugin('block', 'html_head', array($this, 'block_html_head') );
     
    666667   * "explode" variable modifier.
    667668   * Usage :
    668    *    - {assign var=valueExploded value=$value|@explode:','}
     669   *    - {assign var=valueExploded value=$value|explode:','}
    669670   *
    670671   * @param string $text
     
    675676  {
    676677    return explode($delimiter, $text);
     678  }
     679 
     680  /**
     681   * ternary variable modifier.
     682   * Usage :
     683   *    - {$variable|ternary:'yes':'no'}
     684   *
     685   * @param mixed $param
     686   * @param mixed $true
     687   * @param mixed $false
     688   * @return mixed
     689   */
     690  static function mod_ternary($param, $true, $false)
     691  {
     692    return $param ? $true : $false;
    677693  }
    678694
Note: See TracChangeset for help on using the changeset viewer.