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


PHP template::load方法代码示例

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


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

示例1: run

function run()
{
    global $layout;
    global $DB;
    global $website;
    global $theme;
    $out = '';
    switch ($_REQUEST['act']) {
        case "copy_from_template_zones":
            // return template sections and (textarea) properties for a content id
            $template = new template();
            $template->load($_REQUEST['template']);
            $zones = array();
            for ($ts = 0; $ts < count($template->sections); $ts++) {
                $title = $theme->t($template->sections[$ts]['name']);
                if ($title == '#main#') {
                    $title = t(238, 'Main content');
                }
                $zones[] = array('type' => 'section', 'code' => $template->sections[$ts]['code'], 'title' => $title);
            }
            for ($ps = 0; $ps < count($template->properties); $ps++) {
                // ignore non-textual properties
                if (!in_array($template->properties[$ps]->type, array("text", "textarea", "rich_textarea"))) {
                    continue;
                }
                $zones[] = array('type' => 'property', 'code' => $template->properties[$ps]->id, 'title' => $theme->t($template->properties[$ps]->name));
            }
            echo json_encode($zones);
            core_terminate();
            break;
    }
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:32,代码来源:properties.php

示例2: getTemplate

 /**
  * @param $view
  * @return \template
  */
 protected function getTemplate($view)
 {
     $template = new \template();
     $template->setFile(strtok($view, '/'));
     $template->load(strtok('/'));
     return $template;
 }
开发者ID:frogsystem,项目名称:legacy-bridge,代码行数:11,代码来源:Page.php

示例3: index

 function index($params)
 {
     $tpl = new template("includes/v");
     $tpl->load("filters.html", true, true);
     $tpl->setv("formtitle", "Работа с почтовыми фильтрами");
     $tpl->show();
 }
开发者ID:rivetweb,项目名称:old-python-generators,代码行数:7,代码来源:filters_controller.php

示例4: index

 function index($params)
 {
     $subcategory = DB_DataObject::factory("subcategory");
     $tpl = new template("includes/v");
     $tpl->load("subcategories.html", true, true);
     $tpl->setv("formtitle", "Работа с категориями");
     $tpl->show();
 }
开发者ID:rivetweb,项目名称:old-python-generators,代码行数:8,代码来源:subcategories_controller.php

示例5: index

 function index($params)
 {
     $tpl = new template("includes/v");
     $tpl->load("configs.html", true, true);
     $tpl->setv("formtitle", "Редактирование настроек");
     $json = new Services_JSON();
     $config = $json->decode(file::load("data/config.ini"));
     $tpl->setv(array("itemnum" => $config->itemnum, "daynum" => $config->daynum, "email" => $config->email, "emailpassword" => $config->emailpassword, "emailserver" => $config->emailserver, "outputdir" => $config->outputdir, "numthumbs" => $config->numthumbs, "logemail" => $config->logemail));
     $tpl->show();
 }
开发者ID:rivetweb,项目名称:old-python-generators,代码行数:10,代码来源:configs_controller.php

示例6: template

 function send_template_mail($to, $subject, $template, $headers = null)
 {
     $this->using('template');
     $param =& $this->using('param');
     $tpl = new template();
     $template = explode('/', $template);
     $tpl->load(TM_TEMPLATES_DIR . C_TEMPLATE . '/layout/views/' . $template[0] . '/' . $template[1]);
     $tpl->set($param->get_params(), true);
     $message = $tpl->output();
     $this->send_mail($to, $subject, $message, null, $headers);
 }
开发者ID:laiello,项目名称:xiv,代码行数:11,代码来源:services.php

示例7: display

 /**
  * Processes a template and display the output.
  *
  * @param   string          $view_file
  * @param   array           $tpl_vars  (Optional)
  * @return  string
  */
 public function display($view_file, $tpl_vars = null)
 {
     if (file_exists($this->_P . $view_file)) {
         $body = file_get_contents($this->_P . $view_file);
         $body = str_replace('/VIEW_PATH/', $this->_P, $body);
         $this->_T->load($body);
         if (is_array($tpl_vars)) {
             $this->_T->set($tpl_vars);
         }
         $this->_T->display();
     }
 }
开发者ID:zzlphp,项目名称:Yaf_Sample,代码行数:19,代码来源:view.php

示例8: makeCategory

 function makeCategory($config, $subcategory)
 {
     print "Make subcategory {$subcategory['id']} page...\n";
     if (!is_dir($outputdir = "{$config->outputdir}/{$subcategory['folder']}")) {
         mkdir($outputdir);
     }
     $item = DB_DataObject::factory("item");
     $categDays = $item->getDays();
     $pager =& Pager::factory(array("mode" => "Jumping", "perPage" => $config->daynum, "delta" => 10, "itemData" => $categDays, "append" => false, "path" => "../", "fileName" => "{$subcategory['folder']}/index%d.html"));
     for ($i = 1; $i <= $pager->numPages(); $i++) {
         $tpl = new template();
         $tpl->load("templates/category.html", true, true);
         $tpl->setv("category_name", $subcategory["name"]);
         PagesGenerator::getCategories($tpl, "../");
         $data = $pager->getPageData($i);
         $links = $pager->getLinks($i);
         $tpl->setBlock("pages");
         $tpl->setv("pages", $links["all"]);
         foreach ($data as $day) {
             $res = $item->getItemsForDayCateg($subcategory["id"], $day[0], $config->itemnum);
             $res1 = $item->getItemsForDayCateg($subcategory["id"], $day[0], $config->itemnum, true);
             if (sizeof($res) == 0 && sizeof($res1) == 0) {
                 continue;
             }
             $tpl->setBlock("forday");
             $tpl->setv("date", date("Y-m-d", strtotime($day[0])));
             if (sizeof($res) > 0) {
                 foreach ($res as $row) {
                     $tpl->setBlock("rows");
                     $tpl->setv($row);
                     $tpl->parseBlock();
                 }
             }
             if (sizeof($res1) > 0) {
                 $numthumbs = 0;
                 foreach ($res1 as $row) {
                     $tpl->setBlock("thumb");
                     $tpl->setv($row);
                     $tpl->parseBlock();
                     if (++$numthumbs >= $config->numthumbs) {
                         $tpl->parse("rowthumbs");
                         $numthumbs = 0;
                     }
                 }
             }
             $tpl->parse("forday");
         }
         file::save("{$config->outputdir}/{$subcategory['folder']}/index{$i}.html", $tpl->get());
     }
 }
开发者ID:rivetweb,项目名称:old-python-generators,代码行数:50,代码来源:PagesGenerator.php

示例9: template

 function login_form($message = "")
 {
     $tpl = new template("templates/");
     $tpl->load("login.html");
     $tpl->set_block("form");
     $tpl->set_variable("AppTitle", traducir_cadena("AppTitle"));
     $tpl->set_variable("AdminModule", traducir_cadena("AdminModule"));
     $tpl->set_variable("Institute", traducir_cadena("Institute"));
     $tpl->set_variable("WelcomeAdmin", traducir_cadena("WelcomeAdmin"));
     $tpl->set_variable("message", traducir_cadena($message));
     $tpl->set_variable("user", traducir_cadena("user"));
     $tpl->set_variable("password", traducir_cadena("password"));
     $tpl->parse_block("form");
     return $tpl->get();
 }
开发者ID:pelao88,项目名称:evaluaciones,代码行数:15,代码来源:login.php

示例10: template

 function login_form($message = "", $clave_examen = "")
 {
     $tpl = new template("templates/");
     $tpl->load("form.html");
     $tpl->set_block("form");
     $tpl->set_variable("AppTitle", traducir_cadena("AppTitle"));
     $tpl->set_variable("ExamModule", traducir_cadena("ExamModule"));
     $tpl->set_variable("Institute", traducir_cadena("Institute"));
     $tpl->set_variable("WelcomeExam", traducir_cadena("WelcomeExam"));
     $tpl->set_variable("Instructions", traducir_cadena("Instructions"));
     $tpl->set_variable("message", $message);
     $tpl->set_variable("txtsessionid", traducir_cadena("txtsessionid"));
     $sessionid = rand();
     $tpl->set_variable("randval", $sessionid);
     $tpl->set_variable("txtstudentid", traducir_cadena("txtstudentid"));
     $tpl->set_variable("txtidexamen", $clave_examen);
     $tpl->set_variable("txtquestionpaperid", traducir_cadena("txtquestionpaperid"));
     $tpl->set_variable("txtsubmit", traducir_cadena("txtsubmit"));
     $tpl->set_variable("txtreset", traducir_cadena("txtreset"));
     $tpl->set_variable("password", traducir_cadena("password"));
     $tpl->parse_block("form");
     return $tpl->get();
 }
开发者ID:pelao88,项目名称:evaluaciones,代码行数:23,代码来源:model_exam.php

示例11: elseif

    $template->assign("SITE_TITLE", "Startseite");
    $tmpl = $template->display(true);
    $tmpl = $template->operators();
    echo $tmpl;
} else {
    // Handelt es sich um einen Link eines Moduls
    $module = new CHECK_MODULE($page);
    $check_module = $module->check();
    // Manuel angelegte Seite überprüfen
    $check_page = false;
    if ($check_module == false) {
        $check_page = $url_parser->check_page();
    }
    if ($check_module) {
        // Modul init.php laden und includen
        require_once $module->get_init();
    } elseif ($check_page) {
        $template = new template();
        $template->load($check_page);
        $tmpl = $template->display(true);
        $tmpl = $template->operators();
        echo $tmpl;
    } else {
        $template = new template();
        $template->load("404_error");
        $template->assign("SITE_TITLE", "Seite nicht gefunden");
        $tmpl = $template->display(true);
        $tmpl = $template->operators();
        echo $tmpl;
    }
}
开发者ID:TorrnexT,项目名称:fi_network,代码行数:31,代码来源:index.php

示例12:

        $template->setFile('0_polls.tpl');
        $template->load('LIST_LINE');
        $template->tag('question', $poll_arr['poll_quest']);
        $template->tag('url', $poll_arr['poll_url']);
        $template->tag('all_votes', $poll_arr['all_votes']);
        $template->tag('participants', $poll_arr['poll_participants']);
        $template->tag('type', $poll_arr['poll_type']);
        $template->tag('start_date', $poll_arr['poll_start']);
        $template->tag('end_date', $poll_arr['poll_end']);
        $template = $template->display();
        $list_lines .= $template;
    }
    // Get Template
    $template = new \template();
    $template->setFile('0_polls.tpl');
    $template->load('LIST_BODY');
    $template->tag('polls', $list_lines);
    $template->tag('order_question', get_poll_list_order('question', $_GET['sort'], $_GET['order']));
    $template->tag('order_all_votes', get_poll_list_order('all_votes', $_GET['sort'], $_GET['order'], 0));
    $template->tag('order_participants', get_poll_list_order("participants", $_GET['sort'], $_GET['order'], 0));
    $template->tag('order_type', get_poll_list_order('type', $_GET['sort'], $_GET['order']));
    $template->tag('order_start_date', get_poll_list_order('start_date', $_GET['sort'], $_GET['order'], 0));
    $template->tag('order_end_date', get_poll_list_order('end_date', $_GET['sort'], $_GET['order'], 0));
    $template->tag('arrow_question', get_poll_list_arrows('question', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_all_votes', get_poll_list_arrows('all_votes', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_participants', get_poll_list_arrows('participants', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_type', get_poll_list_arrows('type', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_start_date', get_poll_list_arrows('start_date', $_GET['sort'], $_GET['order']));
    $template->tag('arrow_end_date', get_poll_list_arrows('end_date', $_GET['sort'], $_GET['order']));
    $template = $template->display();
}
开发者ID:frogsystem,项目名称:legacy-polls,代码行数:31,代码来源:polls.php

示例13: run

function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    $out = '';
    $item = new template();
    switch ($_REQUEST['act']) {
        case 'json':
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    foreach ($ids as $id) {
                        $item->load($id);
                        $item->delete();
                    }
                    echo json_encode(true);
                    break;
                default:
                    // list or search
                    // we have to merge the theme templates with the custom private templates (which are defined in the DB)
                    // as we don't expect a lot of templates, we will always return the whole dataset
                    // for this reason, paginate is useless
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    if (isset($_REQUEST['quicksearch'])) {
                        $dataset = template::search($orderby, array('quicksearch' => $_REQUEST['quicksearch']));
                    } else {
                        $dataset = template::search($orderby);
                    }
                    $total = count($dataset);
                    $out = array();
                    $permissions = array(0 => '<img src="img/icons/silk/world.png" align="absmiddle" /> ' . t(69, 'Published'), 1 => '<img src="img/icons/silk/world_dawn.png" align="absmiddle" /> ' . t(70, 'Private'), 2 => '<img src="img/icons/silk/world_night.png" align="absmiddle" /> ' . t(81, 'Hidden'));
                    if (empty($dataset)) {
                        $rows = 0;
                    } else {
                        $rows = count($dataset);
                    }
                    for ($i = 0; $i < $rows; $i++) {
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => $dataset[$i]['title'], 2 => $dataset[$i]['theme'], 3 => $permissions[$dataset[$i]['permission']], 4 => $dataset[$i]['enabled'] == 1 ? '<img src="img/icons/silk/accept.png" />' : '<img src="img/icons/silk/cancel.png" />');
                    }
                    navitable::jqgridJson($out, 1, 0, PHP_INT_MAX, $total);
                    break;
            }
            core_terminate();
            break;
        case 'load':
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                if (is_numeric($_REQUEST['id'])) {
                    $item->load(intval($_REQUEST['id']));
                } else {
                    $item->load_from_theme($_REQUEST['id']);
                }
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    if (!empty($_REQUEST['property-enabled'])) {
                        $enableds = array_values($_REQUEST['property-enabled']);
                    } else {
                        $enableds = array();
                    }
                    property::reorder("template", $item->id, $_REQUEST['template-properties-order'], $enableds);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
                users_log::action($_REQUEST['fid'], $item->id, 'save', $item->title, json_encode($_REQUEST));
            } else {
                users_log::action($_REQUEST['fid'], $item->id, 'load', $item->title);
            }
            $out = templates_form($item);
            break;
        case 'save_template_file':
            // save template html
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            $data = $_REQUEST['templates-file-edit-area'];
            $data = str_replace("\r\n", "\r", $data);
            $x = file_put_contents(NAVIGATE_PRIVATE . '/' . $website->id . '/templates/' . $item->file, $data);
            echo json_encode($x > 0);
            session_write_close();
            exit;
            break;
        case 4:
            // remove
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $out = templates_list();
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
//.........这里部分代码省略.........
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:templates.php

示例14: nvweb_template_parse_special

/**
 * Parse special Navigate CMS tags like:
 * <ul>
 * <li>&lt;nv object="include" file="" id="" /&gt;</li>
 * <li>curly bracket tags {{nv object=""}}</li>
 * </ul>
 *
 * Generate the final HTML code for these special tags or convert them
 * to a simpler nv tags.
 *
 * @param $html
 * @return mixed
 */
function nvweb_template_parse_special($html)
{
    global $website;
    global $current;
    // find <pre> and <code> tags, save its contents and leave a placeholder to restore the content later
    $tags_pre = nvweb_tags_extract($html, 'pre', false, true, 'UTF-8');
    for ($t = count($tags_pre); $t--; $t >= 0) {
        $tag = $tags_pre[$t];
        if (empty($tag)) {
            continue;
        }
        $tag_uid = uniqid('nv-tags-pre-');
        $current['delayed_tags_pre'][$tag_uid] = $tag['full_tag'];
        $html = substr_replace($html, '<!--#' . $tag_uid . '#-->', $tag['offset'], strlen($tag['full_tag']));
    }
    $tags_code = nvweb_tags_extract($html, 'code', false, true, 'UTF-8');
    for ($t = count($tags_code); $t--; $t >= 0) {
        $tag = $tags_code[$t];
        if (empty($tag)) {
            continue;
        }
        $tag_uid = uniqid('nv-tags-code-');
        $current['delayed_tags_code'][$tag_uid] = $tag['full_tag'];
        $html = substr_replace($html, '<!--#' . $tag_uid . '#-->', $tag['offset'], strlen($tag['full_tag']));
    }
    $changed = false;
    // translate "{{nv object='list' " tags to "<nv object='list' " version
    preg_match_all("/{{nv\\s object=[\"']list[\"'] ([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        if (stripos($curly_tags[0], 'object="list"')) {
            $tmp = str_ireplace(array('{{nv object="list" ', '}}'), array('<nv object="list" ', '>'), $curly_tags[0][$c]);
            $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        } else {
            $tmp = str_ireplace(array("{{nv object='list' ", '}}'), array('<nv object="list" ', '>'), $curly_tags[0][$c]);
            $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        }
        $changed = true;
    }
    // translate "{{/nv}}" tags to "</nv>" version
    $html = str_ireplace('{{/nv}}', '</nv>', $html);
    // translate "{{nvlist_conditional }}" tags to "<nvlist_conditional >" version
    preg_match_all("/{{nvlist_conditional \\s([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        $tmp = str_replace(array('{{nvlist_conditional ', '}}'), array('<nvlist_conditional ', '>'), $curly_tags[0][$c]);
        $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        $changed = true;
    }
    // translate "{{/nvlist_conditional}}" tags to "</nvlist_conditional>" version
    $html = str_ireplace('{{/nvlist_conditional}}', '</nvlist_conditional>', $html);
    // translate "{{nv }}" tags to "<nv />" version
    preg_match_all("/{{nv\\s([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        $tmp = str_replace(array('{{nv ', '}}'), array('<nv ', ' />'), $curly_tags[0][$c]);
        $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        $changed = true;
    }
    // translate "{{nvlist }}" tags to "<nvlist />" version
    preg_match_all("/{{nvlist\\s([^}]+)}}/ixsm", $html, $curly_tags);
    for ($c = 0; $c < count($curly_tags[0]); $c++) {
        $tmp = str_replace(array('{{nvlist ', '}}'), array('<nvlist ', ' />'), $curly_tags[0][$c]);
        $html = str_ireplace($curly_tags[0][$c], $tmp, $html);
        $changed = true;
    }
    if ($changed) {
        return nvweb_template_parse_special($html);
    }
    // parse includes (we must do it before parsing list or search)
    $tags = nvweb_tags_extract($html, 'nv', true, true, 'UTF-8');
    foreach ($tags as $tag) {
        $content = '';
        $changed = false;
        $tag['length'] = strlen($tag['full_tag']);
        if ($tag['attributes']['object'] == 'include') {
            $tid = $tag['attributes']['id'];
            $file = $tag['attributes']['file'];
            if (!empty($tid)) {
                $template = new template();
                $template->load($tid);
                if ($template->website == $website->id) {
                    $content = file_get_contents(NAVIGATE_PRIVATE . '/' . $website->id . '/templates/' . $template->file);
                }
            } else {
                if (!empty($file)) {
                    $content = file_get_contents(NAVIGATE_PATH . '/themes/' . $website->theme . '/' . $file);
                }
            }
            $html = substr_replace($html, $content, $tag['offset'], $tag['length']);
//.........这里部分代码省略.........
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:nvweb_templates.php

示例15: ini_set

<?php

ini_set('display_errors', 'on');
//informe d'errores
error_reporting(E_ALL);
include 'config.php';
require 'sys/helper.php';
//Session::ini_session();
$conf = Registry::getInstance();
$conf->Welcome = 'Hola';
//set
$msg = $conf->Welcome;
//get
unset($conf->Welcome);
//Coder::codear($conf);
template::load('home');
Core::init();
//crear class registry per tenir acces
//a traves fr sigleton
//a la configuració de l'aplicació
//al fitxer config.json en app
开发者ID:elizabethml,项目名称:Frameworkcontr,代码行数:21,代码来源:index.php


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