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


PHP HTML_Template_Flexy::compile方法代码示例

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


在下文中一共展示了HTML_Template_Flexy::compile方法的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: setVariables

 /**
  * テンプレートの設定
  * @param $templateName
  * @access private
  */
 protected function setVariables($templateName, $obj)
 {
     // Hidden値の設定
     // Flexyを生成する前に $this->_hidden に値を代入しておく
     // Flexyから $this->_hidden が利用される
     $hidden = Container::getInstance()->getComponent('Laiz_Action_Component_Hidden');
     if ($hidden instanceof Laiz_Action_Component_Hidden) {
         foreach ($hidden->getHiddens() as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $hiddenName => $hiddenValue) {
                     $this->setHidden($key, $hiddenName, $hiddenValue);
                 }
             }
         }
     }
     $options = array('templateDir' => $this->TEMPLATE_DIR, 'multiSource' => true, 'compileDir' => $this->FLEXY_COMPILE_DIR, 'numberFormat' => ', 0', 'forceCompile' => $this->FLEXY_FORCE_COMPILE);
     // ユーザ独自の設定
     if ($this->_flexyOptions) {
         $options = array_merge($options, $this->_flexyOptions);
     }
     $rep = error_reporting();
     error_reporting($rep & E_ALL);
     // PEARの関係上Strictエラーを除外する
     $this->flexy = new Fly_Flexy($options);
     // Hidden値の設定
     //$this->flexy->setHiddens($this->_hiddens);
     $this->flexy->compile($templateName);
     $this->_elements = $this->flexy->getElements();
     error_reporting($rep);
     $this->_setVariables($obj);
     $this->_obj = $obj;
 }
开发者ID:nishimura,项目名称:laiz,代码行数:37,代码来源:Flexy.php

示例3: 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

示例4: 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

示例5: 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

示例6: foreach

    $appendName = "";
    if (isset($_REQUEST['estado'])) {
        if ($_REQUEST['estado'] != 0) {
            $appendName .= "[" . $tpl->ESTADOS[$_REQUEST['estado']]['label'] . "]";
        }
    }
    if (isset($_REQUEST['local'])) {
        if ($_REQUEST['local'] != 0) {
            $appendName .= "[" . $tpl->LOCALES[$_REQUEST['local']]['label'] . "]";
        }
    }
    $doc->getActiveSheet()->fromArray($xls, null, 'A1');
    $doc->getActiveSheet()->getStyle('I1:I100')->getNumberFormat()->setFormatCode('[green]$#,##0;[red]$#,##0');
    $doc->getActiveSheet()->getStyle('D1:D100')->getNumberFormat()->setFormatCode('$#,##0');
    foreach (range('A', 'I') as $columnID) {
        $doc->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
    }
    $doc->getActiveSheet()->freezePane("B2");
    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="ventas-' . date("d/m/Y") . $appendName . '.xls"');
    header('Cache-Control: max-age=0');
    // Do your stuff here
    $writer = PHPExcel_IOFactory::createWriter($doc, 'Excel5');
    $writer->save('php://output');
    exit;
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("ventas.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:ventas.php

示例7: outputDefaultTemplate

 /**
  * output the default template with the editing facilities.
  * 
  * @return   none
  * @access   public
  */
 function outputDefaultTemplate()
 {
     $o = array('compileDir' => ini_get('session.save_path') . '/HTML_Template_Flexy_Translate', 'templateDir' => dirname(__FILE__) . '/templates');
     $x = new HTML_Template_Flexy($o);
     $x->compile('translator.html');
     $x->outputObject($this);
 }
开发者ID:q32p,项目名称:emst,代码行数:13,代码来源:Translator.php

示例8: while

if ($cursor && $cursor->num_rows > 0) {
    while ($row = $cursor->fetch_assoc()) {
        $result[$row['LOCAL']][$row['FECHA']] = (int) $row['TOTAL'];
    }
}
$tmp = array();
foreach ($result as $k => $v) {
    foreach ($v as $kk => $vv) {
        $tmp[$kk][$k] = $vv;
    }
}
foreach ($tmp as $k => $v) {
    $row = array($k);
    foreach ($v as $kk => $vv) {
        for ($i = 1; $i < count($val[0]); $i++) {
            $row[$i] = 0;
            if ($kk == $val[0][$i]) {
                $row[$i] = (int) $vv;
            }
        }
    }
    $val[] = $row;
}
//print_r($val);exit;
$tpl->variablesJavascript .= "var ventas = eval('(" . json_encode($val) . ")');\n";
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("local.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:local.php

示例9: Header

$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

示例10: 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

示例11: getInputWidget

function getInputWidget($key, $value = "", $type = "text")
{
    global $sql;
    $retval = '';
    preg_match('/[a-zA-Z]+/', $type, $matches);
    preg_match('/\\[[_\\|\\=a-zA-Z0-9]+\\]/', $type, $options);
    if ($options) {
        $options = str_replace(array('[', ']'), '', $options[0]);
        $tmp = explode("|", $options);
        unset($options);
        foreach ($tmp as $v) {
            $tmp = explode("=", $v);
            $options[$tmp[1]] = $tmp[0];
        }
    }
    switch ($matches[0]) {
        case 'radio':
            foreach ($options as $k => $v) {
                if ($k != '_bootstrap') {
                    $retval .= "<label class='radio inline'>";
                    if ($k == $value) {
                        $retval .= "<input type='radio' name='{$key}' value='{$k}' checked='checked'>{$v}";
                    } else {
                        $retval .= "<input type='radio' name='{$key}' value='{$k}'>{$v}";
                    }
                    $retval .= "</label>";
                }
            }
            break;
        case 'dbcombobox':
            foreach ($options as $k => $v) {
                $ref[$v] = $k;
            }
            $retval .= "<select name='{$key}' value='{$value}'>";
            $query = "SELECT * FROM " . $ref['TABLE'] . ";";
            $result = $sql->con->query($query);
            while ($row = $result->fetch_assoc()) {
                if ($value == $row[$ref['INDEX']]) {
                    $retval .= "\t<option value='" . $row[$ref['INDEX']] . "' selected>" . $row[$ref['LABEL']] . "</option>";
                } else {
                    $retval .= "\t<option value='" . $row[$ref['INDEX']] . "'>" . $row[$ref['LABEL']] . "</option>";
                }
            }
            $retval .= "</select>";
            break;
        case 'textarea':
            if ($options) {
                foreach ($options as $k => $v) {
                    $configs[$v] = $k;
                }
                $cols = $configs['cols'];
                $rows = $configs['rows'];
                $retval .= "<textarea name='{$key}' cols='{$cols}' rows='{$rows}'>";
            } else {
                $retval .= "<textarea name='{$key}'>";
            }
            $retval .= "{$value}</textarea>";
            break;
        case 'tinyMCE':
            $retval = "<textarea id='{$key}' name='{$key}'>{$value}</textarea>";
            $retval .= "<script src=\"//tinymce.cachefly.net/4.1/tinymce.min.js\"></script>";
            $retval .= "<script>tinymce.init({selector:'#{$key}'});</script>";
            break;
        case 'file':
            if (empty($value)) {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/NoDisponible.jpg\" alt=\"Preview\">";
            } else {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/{$value}\" alt=\"Preview\">";
            }
            $retval .= "<input type='{$type}' name='" . $key . "_file' value='{$value}' onchange='previewImage(this)' width='200'>";
            $retval .= "<input type='hidden' name='{$key}' value='{$value}'>";
            break;
        case 'multifile':
            include_once "HTML/Template/Flexy.php";
            $options = array('templateDir' => "inputWidgets/templates", 'compileDir' => "inputWidgets/templates");
            $obj = new stdClass();
            $obj->KEY = $key;
            $obj->JAVASCRIPT = "<script>var key = '" . $key . "'</script>";
            $tmp = unserialize($value);
            if (is_array($tmp)) {
                foreach ($tmp as $tk => $tv) {
                    $obj->FILAS[]['nombre'] = $tv;
                }
            }
            $output = new HTML_Template_Flexy($options);
            $output->compile('multifile.html');
            $retval = $output->bufferedOutputObject($obj);
            break;
        default:
            $retval = "<input type='{$type}' name='{$key}' value='{$value}'>";
            break;
    }
    return $retval;
}
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:94,代码来源:form.php

示例12: array

                continue;
            }
            $file = ic2_check_uploaded_file($path, $name, $type, $filesize, $tmpname, $errcode);
            if (is_array($file)) {
                $upfiles[] = $file;
            } else {
                P2Util::pushInfoHtml($file);
            }
        }
    }
}
// }}}
// {{{ output
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy($_flexy_options);
$flexy->compile('ic2s.tpl.html');
if (!$isPopUp && (!empty($upfiles) || P2Util::hasInfoHtml())) {
    $showForm = false;
} else {
    $showForm = true;
}
// フォームを修正
$elements = $flexy->getElements();
if ($showForm) {
    $form_attr = array('action' => $_SERVER['SCRIPT_NAME'] . '?upload=1', 'accept-charset' => $_conf['accept_charset']);
    $elements['fileupload']->setAttributes($form_attr);
    $elements['MAX_FILE_SIZE']->setValue($maxsize);
    $elements['popup']->setValue($isPopUp);
    if ($isPopUp) {
        $elements['fileupload']->setAttributes('target="_self"');
    } else {
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:31,代码来源:ic2_setter.php

示例13: while

include_once "sesion.php";
$table = "PEDIDO";
$local = $_SESSION['local'];
if (isset($_REQUEST['pedido'])) {
    $pedido = $sql->con->real_escape_string($_REQUEST['pedido']);
    $cursor = $sql->con->query("SELECT * FROM PEDIDO LEFT JOIN RESERVA ON RESERVA_PED=CODIGO__RES WHERE NUMERO__PED='{$pedido}'");
    if ($cursor && $cursor->num_rows > 0) {
        if ($reserva = $cursor->fetch_assoc()) {
            $cant = 1;
            if (empty($reserva['CODIGO__RES'])) {
                $tpl->NEW = true;
            } else {
                $subcursor = $sql->con->query("SELECT * FROM DETALLE_PEDIDO LEFT JOIN PLATO ON PLATO___DEP=CODIGO__PLA WHERE PEDIDO__DEP='" . $reserva['NUMERO__PED'] . "'");
                if ($subcursor && $subcursor->num_rows > 0) {
                    while ($row = $subcursor->fetch_assoc()) {
                        $row['VALOR___PLA'] = "\$" . number_format($row['VALOR___PLA'] * $row['CANTIDADDEP'], 0, ',', '.');
                        $tpl->PLATOS[] = $row;
                    }
                }
            }
            $reserva['FECHA___RES'] = date("d/m/Y H:i", strtotime($reserva['FECHA___RES']));
            $tpl->pagada = true;
            $tpl->RESERVA = $reserva;
        }
    }
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("pedido.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:pedido.php

示例14: exit

                                if (!$sql->addDB("INSUMO", $insert)) {
                                    print_r($sql->con);
                                    exit('Error');
                                }
                                $exitos[] = "Se agregó el insumo " . $insert['NOMBRE__INS'] . ".";
                                $sc = $sql->readDB("LOCAL");
                                if ($sc && $sc->num_rows > 0) {
                                    while ($r = $sc->fetch_assoc()) {
                                        if ($r['CODIGO__LOC'] == $local) {
                                            $insloc = array("INSUMO__ILC" => $value['codigo'], "LOCAL___ILC" => $r['CODIGO__LOC'], "CANTIDADILC" => $value['cantidad']);
                                        } else {
                                            $insloc = array("INSUMO__ILC" => $value['codigo'], "LOCAL___ILC" => $r['CODIGO__LOC'], "CANTIDADILC" => 0);
                                        }
                                        $sql->addDB("INSUMO_LOCAL", $insloc);
                                    }
                                }
                            }
                        }
                    }
                }
                $tpl->EXITOS = $exitos;
                $tpl->ERRORES = $errores;
            }
            break;
    }
}
$options = array('templateDir' => 'templates', 'compileDir' => 'tmp');
$output = new HTML_Template_Flexy($options);
$output->compile("excel.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
require_once "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:excel.php

示例15: array

<?php

/* Mini test suite */
require_once 'HTML/Template/Flexy.php';
//print_r($_SERVER['argv']);
if (!isset($_SERVER['argv'][1])) {
    $files = array(dirname(__FILE__) . '/index.tpl');
} else {
    $files = $_SERVER['argv'];
    array_shift($files);
}
//print_r($files);
foreach ($files as $file) {
    $dir = dirname($file);
    $x = new HTML_Template_Flexy(array('compileDir' => dirname(__FILE__), 'templateDir' => $dir, 'locale' => 'en', 'forceCompile' => true, 'debug' => false, 'nonHTML' => false, 'allowPHP' => false, 'compiler' => 'SmartyConvertor', 'compileToString' => true, 'filters' => array(), 'numberFormat' => ",2,'.',','", 'flexyIgnore' => 0));
    echo $x->compile(basename($file));
}
开发者ID:ranvis,项目名称:HTML_Template_Flexy,代码行数:17,代码来源:smartytest.php


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