Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * Smarty plugin
  4:  *
  5:  * @package    Smarty
  6:  * @subpackage PluginsFunction
  7:  */
  8: 
  9: /**
 10:  * Smarty {cycle} function plugin
 11:  * Type:     function<br>
 12:  * Name:     cycle<br>
 13:  * Date:     May 3, 2002<br>
 14:  * Purpose:  cycle through given values<br>
 15:  * Params:
 16:  * <pre>
 17:  * - name      - name of cycle (optional)
 18:  * - values    - comma separated list of values to cycle, or an array of values to cycle
 19:  *               (this can be left out for subsequent calls)
 20:  * - reset     - boolean - resets given var to true
 21:  * - print     - boolean - print var or not. default is true
 22:  * - advance   - boolean - whether or not to advance the cycle
 23:  * - delimiter - the value delimiter, default is ","
 24:  * - assign    - boolean, assigns to template var instead of printed.
 25:  * </pre>
 26:  * Examples:<br>
 27:  * <pre>
 28:  * {cycle values="#eeeeee,#d0d0d0d"}
 29:  * {cycle name=row values="one,two,three" reset=true}
 30:  * {cycle name=row}
 31:  * </pre>
 32:  *
 33:  * @link     http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
 34:  *           (Smarty online manual)
 35:  * @author   Monte Ohrt <monte at ohrt dot com>
 36:  * @author   credit to Mark Priatel <mpriatel@rogers.com>
 37:  * @author   credit to Gerard <gerard@interfold.com>
 38:  * @author   credit to Jason Sweat <jsweat_php@yahoo.com>
 39:  * @version  1.3
 40:  *
 41:  * @param array                    $params   parameters
 42:  * @param Smarty_Internal_Template $template template object
 43:  *
 44:  * @return string|null
 45:  */
 46: 
 47: function smarty_function_cycle($params, $template)
 48: {
 49:     static $cycle_vars;
 50: 
 51:     $name = (empty($params['name'])) ? 'default' : $params['name'];
 52:     $print = (isset($params['print'])) ? (bool) $params['print'] : true;
 53:     $advance = (isset($params['advance'])) ? (bool) $params['advance'] : true;
 54:     $reset = (isset($params['reset'])) ? (bool) $params['reset'] : false;
 55: 
 56:     if (!isset($params['values'])) {
 57:         if (!isset($cycle_vars[$name]['values'])) {
 58:             trigger_error("cycle: missing 'values' parameter");
 59: 
 60:             return;
 61:         }
 62:     } else {
 63:         if (isset($cycle_vars[$name]['values'])
 64:             && $cycle_vars[$name]['values'] != $params['values']
 65:         ) {
 66:             $cycle_vars[$name]['index'] = 0;
 67:         }
 68:         $cycle_vars[$name]['values'] = $params['values'];
 69:     }
 70: 
 71:     if (isset($params['delimiter'])) {
 72:         $cycle_vars[$name]['delimiter'] = $params['delimiter'];
 73:     } elseif (!isset($cycle_vars[$name]['delimiter'])) {
 74:         $cycle_vars[$name]['delimiter'] = ',';
 75:     }
 76: 
 77:     if (is_array($cycle_vars[$name]['values'])) {
 78:         $cycle_array = $cycle_vars[$name]['values'];
 79:     } else {
 80:         $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']);
 81:     }
 82: 
 83:     if (!isset($cycle_vars[$name]['index']) || $reset) {
 84:         $cycle_vars[$name]['index'] = 0;
 85:     }
 86: 
 87:     if (isset($params['assign'])) {
 88:         $print = false;
 89:         $template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
 90:     }
 91: 
 92:     if ($print) {
 93:         $retval = $cycle_array[$cycle_vars[$name]['index']];
 94:     } else {
 95:         $retval = null;
 96:     }
 97: 
 98:     if ($advance) {
 99:         if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) {
100:             $cycle_vars[$name]['index'] = 0;
101:         } else {
102:             $cycle_vars[$name]['index'] ++;
103:         }
104:     }
105: 
106:     return $retval;
107: }
108: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen