当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_Template_Flexy类代码示例

本文整理汇总了PHP中HTML_Template_Flexy的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Template_Flexy类的具体用法?PHP HTML_Template_Flexy怎么用?PHP HTML_Template_Flexy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HTML_Template_Flexy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getHTML

 public function getHTML($small = false)
 {
     global $install, $sql;
     include_once "HTML/Template/Flexy.php";
     $config = new Configuracion($sql);
     $this->data->TITLE = $config->get("Nombre del Sitio");
     $map = $config->get("Coordenadas del Mapa");
     $marker = $config->get("Coordenadas del Marcador");
     if ($map) {
         $map = split(",", $map);
         $this->data->MAP = "<script>\nvar lat = " . $map[0] . ";\nvar lon = " . $map[1] . ";\n</script>";
     }
     if ($marker) {
         $marker = split(",", $marker);
         $this->data->MARKER = "<script>\nvar latMarker = " . $marker[0] . ";\nvar lonMarker = " . $marker[1] . ";\n</script>";
     }
     $options = array('compileDir' => $install . '/tmp', 'templateDir' => $install . '/template');
     if ($small) {
         $template = "content.small.html";
     } else {
         $template = $this->data->data["TEMPLATECON"];
         $cursor = $sql->readDB("TEMPLATE", "ID______TEM={$template}");
         $res = $cursor->fetch_assoc();
         $template = $res["FILE____TEM"];
     }
     $output = new HTML_Template_Flexy($options);
     $output->compile($template);
     return $output->bufferedOutputObject($this->data);
 }
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:29,代码来源:Contenido.php

示例2: compileAll

function compileAll($options, $files = array())
{
    // loop through
    $dh = opendir(dirname(__FILE__) . '/templates/');
    while (false !== ($file = readdir($dh))) {
        if ($file[0] == '.') {
            continue;
        }
        if (is_dir(dirname(__FILE__) . '/templates/' . $file)) {
            continue;
        }
        // skip if not listed in files (and it's an array)
        if ($files && !in_array($file, $files)) {
            continue;
        }
        $x = new HTML_Template_Flexy($options);
        echo "compile  {$file} \n";
        $res = $x->compile($file);
        if ($res !== true) {
            echo "Compile failure: " . $res->toString() . "\n";
        }
    }
}
开发者ID:ranvis,项目名称:HTML_Template_Flexy,代码行数:23,代码来源:test.php

示例3: compilefile

function compilefile($file, $data = array(), $options = array(), $elements = array())
{
    $options = $options + array('templateDir' => dirname(__FILE__) . '/templates', 'forceCompile' => true, 'fatalError' => HTML_TEMPLATE_FLEXY_ERROR_RETURN, 'url_rewrite' => 'images/:/myproject/images/', 'compileDir' => dirname(__FILE__) . '/results1');
    // basic options..
    echo "\n\n===Compiling {$file}===\n\n";
    $options['compileDir'] = dirname(__FILE__) . '/results1';
    $x = new HTML_Template_Flexy($options);
    $res = $x->compile($file);
    if ($res !== true) {
        echo "===Compile failure==\n" . $res->toString() . "\n";
        return;
    }
    echo "\n\n===Compiled file: {$file}===\n";
    echo file_get_contents($x->compiledTemplate);
    if (!empty($options['show_elements'])) {
        print_r($x->getElements());
    }
    if (!empty($options['show_words'])) {
        print_r(unserialize(file_get_contents($x->gettextStringsFile)));
    }
    echo "\n\n===With data file: {$file}===\n";
    $data = (object) $data;
    $x->outputObject($data, $elements);
}
开发者ID:ranvis,项目名称:HTML_Template_Flexy,代码行数:24,代码来源:testsuite.php

示例4: outputBody

 function outputBody()
 {
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - start');
     }
     $ff = HTML_FlexyFramework::get();
     $proj = $ff->project;
     // DB_DataObject::debugLevel(1);
     $m = DB_DAtaObject::factory('Builder_modules');
     $m->get('name', $proj);
     //var_dump($m->path);exit;
     // needs to modify the template directory??
     // use the builder_module == app name
     // look for part with same name.
     if (empty($ff->Pman_Builder['from_filesystem'])) {
         $template_engine = new HTML_Template_Flexy(array('templateDir' => $m->path));
     } else {
         $template_engine = new HTML_Template_Flexy();
     }
     $template_engine->debug = 1;
     //print_R($template_engine);
     $template_engine->compile($this->template);
     if ($this->elements) {
         /* BC crap! */
         $this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements, $this->errors);
     }
     $template_engine->elements = $this->elements;
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - render template');
     }
     //DB_DataObject::debugLevel(1);
     $template_engine->outputObject($this, $this->elements);
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - end');
     }
 }
开发者ID:roojs,项目名称:Pman.Builder,代码行数:36,代码来源:Preview.php

示例5: applyFilters

 /**
  *   actually it will only be used to apply the pre and post filters
  *
  *   @access     public
  *   @version    01/12/10
  *   @author     Alan Knowles <alan@akbkhome.com>
  *   @param      string  $input      the string to filter
  *   @param      array   $prefix     the subset of methods to use.
  *   @return     string  the filtered string
  */
 function applyFilters($input, $prefix = "", $negate = FALSE)
 {
     $this->flexy->debug("APPLY FILTER {$prefix}<BR>");
     $filters = $this->options['filters'];
     $this->flexy->debug(serialize($filters) . "<BR>");
     foreach ($filters as $filtername) {
         $class = "HTML_Template_Flexy_Compiler_Regex_{$filtername}";
         require_once "HTML/Template/Flexy/Compiler/Regex/{$filtername}.php";
         if (!class_exists($class)) {
             return HTML_Template_Flexy::staticRaiseError("Failed to load filter {$filter}", null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
         }
         if (!@$this->filter_objects[$class]) {
             $this->filter_objects[$class] = new $class();
             $this->filter_objects[$class]->_set_engine($this);
         }
         $filter =& $this->filter_objects[$class];
         $methods = get_class_methods($class);
         $this->flexy->debug("METHODS:");
         $this->flexy->debug(serialize($methods) . "<BR>");
         foreach ($methods as $method) {
             if ($method[0] == "_") {
                 continue;
                 // private
             }
             if ($method == $class) {
                 continue;
                 // constructor
             }
             $this->flexy->debug("TEST: {$negate} {$prefix} : {$method}");
             if ($negate && preg_match($prefix, $method)) {
                 continue;
             }
             if (!$negate && !preg_match($prefix, $method)) {
                 continue;
             }
             $this->flexy->debug("APPLYING {$filtername} {$method}<BR>");
             $input = $filter->{$method}($input);
         }
     }
     return $input;
 }
开发者ID:q32p,项目名称:emst,代码行数:51,代码来源:Regex.php

示例6: stdClass

<?php

$tpl = new stdClass();
include_once "common.php";
require_once "HTML/Template/Flexy.php";
include_once "sesion.php";
$table = "RESERVA";
$tpl->variablesJavascript = "<script type='text/javascript'>";
$local = $_SESSION['local'];
$tpl->variablesJavascript .= "var local = '" . $local . "';\n";
$tpl->MAPA = "";
$cursor = $sql->readDB("LOCAL", "CODIGO__LOC='{$local}'");
if ($cursor && $cursor->num_rows > 0) {
    if ($data = $cursor->fetch_assoc()) {
        $tpl->MAPA = $data['PLANO___LOC'];
    }
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("selecciona-mesa.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:23,代码来源:selecciona-mesa.php

示例7: _loadPlugins

 /**
  * Load the plugins, and lookup which one provides the required method 
  *
  * 
  * @param   string           Name
  *
  * @return   string|PEAR_Error   the class that provides it.
  * @access   private
  */
 function _loadPlugins($name)
 {
     // name can be:
     // ahref = maps to {class_prefix}_ahref::ahref
     $this->plugins = array();
     if (empty($this->plugins)) {
         foreach ($this->flexy->options['plugins'] as $cname => $file) {
             if (!is_int($cname)) {
                 include_once $file;
                 $this->plugins[$cname] = new $cname();
                 $this->plugins[$cname]->flexy =& $this->flexy;
                 continue;
             }
             $cname = $file;
             require_once 'HTML/Template/Flexy/Plugin/' . $cname . '.php';
             $class = "HTML_Template_Flexy_Plugin_{$cname}";
             $this->plugins[$class] = new $class();
             $this->plugins[$class]->flexy =& $this->flexy;
         }
     }
     foreach ($this->plugins as $class => $o) {
         //echo "checking :". get_class($o). ":: $name\n";
         if (is_callable(array($o, $name), true)) {
             return $class;
         }
     }
     return HTML_Template_Flexy::raiseError("could not find plugin with method: '{$name}'");
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:37,代码来源:Plugin.php

示例8: ic2_loadconfig

// 設定読み込み
$ini = ic2_loadconfig();
if ($ini['Viewer']['cache'] && file_exists($_conf['iv2_cache_db_path'])) {
    $viewer_cache_exists = true;
} else {
    $viewer_cache_exists = false;
}
// データベースに接続
$db = DB::connect($ini['General']['dsn']);
if (DB::isError($db)) {
    p2die($db->getMessage());
}
// テンプレートエンジン初期化
$_flexy_options =& PEAR5::getStaticProperty('HTML_Template_Flexy', 'options');
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ImageCache2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy();
// }}}
// {{{ データベース操作・ファイル削除
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        // 画像を削除する
        case 'dropZero':
        case 'dropAborn':
            if ($_POST['action'] == 'dropZero') {
                // ランク=0 の画像を削除する
                $where = $db->quoteIdentifier('rank') . ' = 0';
                if (isset($_POST['dropZeroLimit'])) {
                    // 取得した期間を限定
                    switch ($_POST['dropZeroSelectTime']) {
                        case '24hours':
                            $expires = 86400;
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:ic2_manager.php

示例9: functionToString

 /**
  * Handler for User defined functions in templates..
  * <flexy:function name="xxxxx">.... </flexy:block>  // equivilant to function xxxxx() { 
  * <flexy:function call="{xxxxx}">.... </flexy:block>  // equivilant to function {$xxxxx}() { 
  * <flexy:function call="xxxxx">.... </flexy:block>  // equivilant to function {$xxxxx}() { 
  * 
  * This will not handle nested blocks initially!! (and may cause even more problems with 
  * if /foreach stuff..!!
  *
  * @param    object token to convert into a element.
  * @access   public
  */
 function functionToString($element)
 {
     if ($arg = $element->getAttribute('NAME')) {
         // this is a really kludgy way of doing this!!!
         // hopefully the new Template Package will have a sweeter method..
         $GLOBALS['_HTML_TEMPLATE_FLEXY']['prefixOutput'] .= $this->compiler->appendPHP("\nfunction _html_template_flexy_compiler_standard_flexy_{$arg}(\$t,\$this) {\n") . $element->compileChildren($this->compiler) . $this->compiler->appendPHP("\n}\n");
         return '';
     }
     if (!isset($element->ucAttributes['CALL'])) {
         return HTML_Template_Flexy::raiseError(' tag flexy:function needs an argument call or name' . " Error on Line {$element->line} &lt;{$element->tag}&gt;", null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
     }
     // call is a  stirng : nice and simple..
     if (is_string($element->ucAttributes['CALL'])) {
         $arg = $element->getAttribute('CALL');
         return $this->compiler->appendPHP("if (function_exists('_html_template_flexy_compiler_standard_flexy_'.{$arg})) " . " _html_template_flexy_compiler_standard_flexy_{$arg}(\$t,\$this);");
     }
     // we make a big assumption here.. - it should really be error checked..
     // that the {xxx} element is item 1 in the list...
     $e = $element->ucAttributes['CALL'][1];
     $add = $e->toVar($e->value);
     if (is_a($add, 'PEAR_Error')) {
         return $add;
     }
     return $this->compiler->appendPHP("if (function_exists('_html_template_flexy_compiler_standard_flexy_'.{$add})) " . "call_user_func_array('_html_template_flexy_compiler_standard_flexy_'.{$add},array(\$t,\$this));");
 }
开发者ID:villos,项目名称:tree_admin,代码行数:37,代码来源:Flexy.php

示例10: toStringTag

 /**
  *   HTML_Template_Flexy_Token_Tag toString 
  *
  * @param    object    HTML_Template_Flexy_Token_Tag
  * 
  * @return   string     string to build a template
  * @access   public 
  * @see      toString*
  */
 function toStringTag($element)
 {
     $original = $element->getAttribute('ALT');
     // techncially only input type=(submit|button|input) alt=.. applies, but we may
     // as well translate any occurance...
     if (($element->tag == 'IMG' || $element->tag == 'INPUT') && is_string($original) && strlen($original)) {
         $this->addStringToGettext($original);
         $quote = $element->ucAttributes['ALT'][0];
         $element->ucAttributes['ALT'] = $quote . $this->flexy->translateString($original) . $quote;
     }
     $original = $element->getAttribute('TITLE');
     if (is_string($original) && strlen($original)) {
         $this->addStringToGettext($original);
         $quote = $element->ucAttributes['TITLE'][0];
         $element->ucAttributes['TITLE'] = $quote . $this->flexy->translateString($original) . $quote;
     }
     if (strpos($element->tag, ':') === false) {
         $namespace = 'Tag';
     } else {
         $bits = explode(':', $element->tag);
         $namespace = $bits[0];
     }
     if ($namespace[0] == '/') {
         $namespace = substr($namespace, 1);
     }
     if (empty($this->tagHandlers[$namespace])) {
         require_once 'HTML/Template/Flexy/Compiler/Flexy/Tag.php';
         $this->tagHandlers[$namespace] =& HTML_Template_Flexy_Compiler_Flexy_Tag::factory($namespace, $this);
         if (!$this->tagHandlers[$namespace]) {
             return HTML_Template_Flexy::staticRaiseError('HTML_Template_Flexy::failed to create Namespace Handler ' . $namespace . ' in file ' . $GLOBALS['_HTML_TEMPLATE_FLEXY']['filename'], HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
         }
     }
     return $this->tagHandlers[$namespace]->toString($element);
 }
开发者ID:q32p,项目名称:emst,代码行数:43,代码来源:Flexy.php

示例11: array

$urlsPriority = array();
$base = "http://" . $_SERVER['HTTP_HOST'];
$urls = array();
$urlsPriority[] = $base;
$cursor = $sql->readDB("CATEGORIA", "ESTADO__CAT='A'");
while ($row = $cursor->fetch_assoc()) {
    $url = url_slug($row['NOMBRE__CAT']);
    if ($row['PADRE___CAT'] == '-1') {
        $urlsPriority[] = $base . "/" . $url;
    } else {
        $urls[] = $base . "/" . $url;
    }
}
if ($cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'")) {
    while ($row = $cursor->fetch_assoc()) {
        if (!empty($row['TITULO__CON'])) {
            $url = url_slug($row['TITULO__CON']);
        } else {
            $url = "contenido=" . $row["ID______CON"];
        }
        $urls[] = $base . "/" . $url;
    }
}
$tpl->PRIORITY = $urlsPriority;
$tpl->URLS = $urls;
$tpl->DATE = date(DATE_ATOM);
//*
$output = new HTML_Template_Flexy(array('templateDir' => $install . "/template", 'compileDir' => $install . '/tmp'));
$output->compile("sitemap.xml");
$output->outputObject($tpl);
//*/
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:sitemap.php

示例12: display

 /**
  * output a template (optionally with flexy object & element.)
  *
  * @param   string         name of flexy template.
  * @param   object         object as per HTML_Template_Flexy:outputObject
  * @param   array          elements array as per HTML_Template_Flexy:outputObject    
  * 
  * @return   none
  * @access   public
  */
 function display($templatename, $object = null, $elements = array())
 {
     // some standard stuff available to a smarty template..
     $this->vars['SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME'];
     $o = PEAR::getStaticProperty('HTML_Template_Flexy', 'options');
     require_once 'HTML/Template/Flexy.php';
     $t = new HTML_Template_Flexy();
     $t->compile($templatename);
     $object = $object !== null ? $object : new StdClass();
     foreach ($this->vars as $k => $v) {
         $object->{$k} = $v;
     }
     $t->outputObject($object, $elements);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:24,代码来源:SmartyAPI.php

示例13: str_replace

    }
    $curDate .= " 00:00:00";
    $tpl->FECHA = str_replace(' 00:00:00', '', $curDate);
    $cursor = $sql->con->query($q = "SELECT * FROM RESERVA LEFT JOIN CLIENTE ON RUTCLIENRES=RUT_____CLI LEFT JOIN MESA ON MESA____RES=ID______MES LEFT JOIN PEDIDO ON RESERVA_PED=CODIGO__RES LEFT JOIN ESTADO_PEDIDO ON ESTADO__PED=ID______EPE WHERE FECHA___RES BETWEEN '" . $curDate . "' AND DATE_ADD('" . $curDate . "', INTERVAL 1 DAY) {$cond} ORDER BY APELLIDOCLI ASC,FECHA___RES DESC");
    // /*AND NOW() BETWEEN FECHA___RES AND DATE_SUB(FECHA___RES, INTERVAL -DURACIONRES HOUR)*/
    if ($cursor && $cursor->num_rows > 0) {
        while ($row = $cursor->fetch_assoc()) {
            $hora = split(" ", $row['FECHA___RES'])[1];
            $estado = $row['ESTADO__PED'] < 6 ? !empty($row['ESTADO__PED']) ? 'En Curso' : 'Reservada' : 'Finalizada';
            $tpl->RESERVA[$row['CODIGO__RES']] = array("link" => $row['CODIGO__RES'], "mesa" => $row['NUMERO__MES'], "cliente" => $row['RUT_____CLI'] ? $row['APELLIDOCLI'] . ", " . $row['NOMBRE__CLI'] : "Cliente sin Registro", "hora" => $hora, "estado" => $row['DESCRIPCEPE'], "class" => 'reserva-' . $row['ID______EPE']);
        }
    }
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("reservas.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
function codigo()
{
    global $sql;
    $charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $key = '';
    for ($i = 0; $i < 12; $i++) {
        $key .= $charset[mt_rand(0, strlen($charset) - 1)];
    }
    $cursor = $sql->readDB("RESERVA", "CODIGO__RES='" . $key . "'");
    if ($cursor && $cursor->num_rows > 0) {
        return codigo();
    } else {
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:reservas.php

示例14: while

$cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'");
while ($row = $cursor->fetch_assoc()) {
    if (url_slug($row['TITULO__CON']) == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
    if ("contenido=" . $row["ID______CON"] == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
}
$cursor = $sql->readDB("CATEGORIA");
while ($row = $cursor->fetch_assoc()) {
    if (url_slug($row['NOMBRE__CAT']) == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
}
if (!$error) {
    Header("HTTP/1.0 200 OK");
    $_REQUEST['bufferedHTML'] = true;
    $_REQUEST['what'] = substr($_SERVER['REQUEST_URI'], 1);
    include_once "getContent.php";
    $content = $retval['html'];
    $content .= "<script>var error = true; var passedURL = '" . substr($_SERVER['REQUEST_URI'], 1) . "';</script>";
    include_once "container.php";
    exit;
}
$options = array('templateDir' => $install . "/template", 'compileDir' => $install . "/tmp");
$object = new HTML_Template_Flexy($options);
$object->compile("error.html");
$content = $object->bufferedOutputObject($tpl);
$content .= "<script>var error = true; var passedURL = 'home';</script>";
include_once "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:error.php

示例15: toStringTag

 /**
  *   HTML_Template_Flexy_Token_Tag toString 
  *
  * @param    object    HTML_Template_Flexy_Token_Tag
  * 
  * @return   string     string to build a template
  * @access   public 
  * @see      toString*
  */
 function toStringTag($element)
 {
     if (strpos($element->tag, ':') === false) {
         $namespace = 'Tag';
     } else {
         $bits = explode(':', $element->tag);
         $namespace = $bits[0];
     }
     if ($namespace[0] == '/') {
         $namespace = substr($namespace, 1);
     }
     if (empty($this->tagHandlers[$namespace])) {
         require_once 'HTML/Template/Flexy/Compiler/Standard/Tag.php';
         $this->tagHandlers[$namespace] =& HTML_Template_Flexy_Compiler_Standard_Tag::factory($namespace, $this);
         if (!$this->tagHandlers[$namespace]) {
             return HTML_Template_Flexy::raiseError('HTML_Template_Flexy::failed to create Namespace Handler ' . $namespace . ' in file ' . $GLOBALS['_HTML_TEMPLATE_FLEXY']['filename'], HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
         }
     }
     return $this->tagHandlers[$namespace]->toString($element);
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:29,代码来源:Standard.php


注:本文中的HTML_Template_Flexy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。