• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Template类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: action_linkpopup

 function action_linkpopup($args)
 {
     global $config, $manager, $tree, $user, $lang;
     $tpl = new Template($this->getTemplate('main.template'));
     if ($config->get('multiLanguageSupport')) {
         @(include _BASE_LIBRARIES_ . 'resources/iso639to3166.php');
         $languages = array();
         $list = new languages(_DEFAULT_SITE_);
         while (list(, $language) = each($list->nodes)) {
             if ($language->public) {
                 $languages[] = array('id' => $language->id, 'name' => $language->name, 'flag' => strtolower($iso639to3166[$language->id]));
             }
         }
         $tpl->set('languages', $languages);
     }
     // Call the RetrieveObjects functions of each plugin
     if (count($args)) {
         $id = array_shift($args);
         $result = array();
         $files = array();
         $data = array('id' => intval($id), 'result' => &$result);
         $manager->handleEvent('RetrieveObjects', $data);
         while (list(, $entries) = each($result)) {
             $files = array_merge($files, $entries);
         }
         $tpl->set('files', $files);
     }
     echo $tpl->fetch();
     exit;
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:30,代码来源:plugin.php


示例2: disp

 function disp()
 {
     $t = new Template(WEB_ADMIN_TMPPATH);
     $dispObj = new DispAttachRule(&$this->dbObj, $this->getUid());
     $t->set_file('f', 'pageconfig.html');
     $t->set_block('f', 'row', 'r');
     $p = $_GET['pageid'] + 0;
     $sql = "\r\n\t\t\tSELECT c.configvalue AS userdefalut,o.* FROM " . WEB_ADMIN_TABPOX . "otherrule o \r\n\t\t\t\tLEFT OUTER JOIN " . WEB_ADMIN_TABPOX . "config c ON ( (o.otherruleid = c.otherruleid) AND (c.userid = " . $this->getUid() . ") ) \r\n\t\t\tWHERE (o.isrule = 0) AND (o.issystemvar = 0) AND (o.ruleid = {$p})\r\n\t\t";
     $rs = $this->dbObj->GetArray($sql);
     foreach ($rs as $v) {
         $t->set_var($dispObj->disp($v, $v['userdefalut']));
         $t->parse('r', 'row', true);
     }
     $r = '';
     $m = new Menu(&$this->dbObj);
     $s = $m->getRelating($p);
     for ($i = 0; $i < count($s); $i++) {
         if ($i == 0) {
             $r = $s[$i]['rulename'];
         } else {
             $r .= ' > ' . $s[$i]['rulename'];
         }
     }
     $t->set_var('updid', $p);
     $t->set_var('address', $r);
     $t->set_var('path', WEB_ADMIN_HTTPPATH . '/common/');
     $t->parse('out', 'f');
     $t->p('out');
 }
开发者ID:TonyWoo,项目名称:cmlerp,代码行数:29,代码来源:pageconfig.php


示例3: getCode

 /**
  *
  * @return string
  */
 public function getCode()
 {
     if (isset($_POST['save'])) {
         foreach ($_POST as $property => $value) {
             if ($property != "save" && $property != "roles") {
                 $settings = Settings::getRootInstance()->specify($this->areaType, $this->area);
                 if ($this->dir != "" && $this->dir != "/") {
                     $settings = $settings->dir($this->dir);
                 }
                 $settings->set($property, $value, $this->role);
             }
         }
         Settings::forceReload();
         Cache::clear();
         Language::GetGlobal()->ClearCache();
         if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) {
             exit;
         } else {
             die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>");
         }
         $changed = true;
     }
     $template = new Template();
     $template->load($this->template);
     if ($this->area != "global" || $this->areaType != "global") {
         $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
     } else {
         $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
     }
     $roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name");
     if ($roles) {
         foreach ($roles as $role) {
             if ($this->role == $role->id) {
                 $roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
             } else {
                 $roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>";
             }
         }
     }
     $roleselector .= "</select>";
     $template->assign_var("ROLES", $roleselector);
     if ($this->area != "global" || $this->areaType != "global") {
         $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1");
     } else {
         $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1");
     }
     $rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role);
     if ($rows) {
         foreach ($rows as $row) {
             $index = $template->add_loop_item("SETTINGS");
             $template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']);
             $template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description']));
             $control = new $row['type']();
             $control->name = $row['name'];
             $control->value = $row['value'];
             $template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode());
         }
     }
     return $template->getCode();
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:64,代码来源:settingsform.php


示例4: event_ExecuteEditor

 function event_ExecuteEditor(&$data)
 {
     global $lang, $manager, $user;
     if (isset($manager->types[$data['type']]['content']['story']) && $data['sheet'] == 'contents') {
         // Retrieve story
         $res = sql::query("\n\t\t\t\t\tSELECT \n\t\t\t\t\t\t*\n\t\t\t\t\tFROM \n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_story \n\t\t\t\t\tWHERE \n\t\t\t\t\t\t`ID` = '" . $data['params']['id'] . "' AND\n\t\t\t\t\t\t`revision` = '" . $data['params']['revision'] . "'\n\t\t\t\t");
         if ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
             $story = $row;
         } else {
             $story = array('text' => '');
         }
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $_POST['text'] = filter::images($_POST['text']);
             $_POST['text'] = filter::html($_POST['text']);
             $res = sql::query("\n\t\t\t\t\t\tREPLACE INTO \n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_story \n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\tID='" . $data['params']['id'] . "', \n\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\n\t\t\t\t\t\t\ttext='" . addslashes($_POST['text']) . "'\n\t\t\t\t\t");
             // Mark this action as a modification
             revisions::updateModificationDate($data['params']['id'], $data['params']['revision']);
             header("Location: " . url::item($data['params']['id'], 'edit') . "/contents?revision=" . $data['params']['revision']);
             exit;
         }
         $tpl = new Template($this->getTemplate('editor.template'));
         $tpl->set('story', $story);
         $tpl->set('id', $data['params']['id']);
         $tpl->set('revision', $data['params']['revision']);
         $data['template']->append('content', $tpl->fetch());
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:27,代码来源:plugin.php


示例5: applyCommonVariables

 /**
  * Apply common variables to the header template
  * Common variables include:
  * * pageStylesheets
  * * pageJavascripts
  * * urlbase
  *
  * @access protected
  * @return void
  * @param Template $tpl
  * @param boolean $options 
  */
 protected function applyCommonVariables($tpl, $options = false)
 {
     $config = $this->sl->get('aetherConfig');
     if (!$options) {
         $options = $config->getOptions();
     }
     $tpl->set('urlbase', $config->getBase());
     // Stylesheets. Read from config and code
     $styles = array();
     if (array_key_exists('styles', $options)) {
         $styles = explode(';', $options['styles']);
     }
     foreach ($this->sl->getVector('styles') as $style) {
         $styles[] = $style;
     }
     $styles = array_map('trim', $styles);
     $styles = array_unique($styles);
     $tpl->set('pageStylesheets', $styles);
     // Scripts
     $scripts = array();
     if (array_key_exists('javascripts', $options)) {
         $scripts = explode(';', $options['javascripts']);
     }
     foreach ($this->sl->getVector('javascripts') as $script) {
         $scripts[] = $script;
     }
     $scripts = array_map('trim', $scripts);
     $scripts = array_unique($scripts);
     $tpl->set('pageJavascripts', $scripts);
 }
开发者ID:M4R7iNP,项目名称:aether,代码行数:42,代码来源:AetherModuleHeader.php


示例6: service_genButton_paypal

/**
*   Create the payment buttons for an external item.
*   Creates the requested buy_now button type and, if requested,
*   an add_cart button.
*
*   All gateways that have the 'external' service enabled as well as the
*   requested button type will provide a button.
*
*   $args['btn_type'] can be empty or not set, to create only an Add to Cart
*   button.  $args['add_cart'] must still be set in this case.  If neither
*   button type is requested, an empty array is returned.
*
*   Provided $args should include at least:
*       'item_number', 'item_name', 'price', 'quantity', and 'item_type'
*   $args['btn_type'] should reflect the type of immediate-purchase button
*   desired.  $args['add_cart'] simply needs to be set to get an add-to-cart
*   button.
*
*   @uses   PaymentGw::ExternalButton()
*   @param  array   $args       Array of item information
*   @param  array   &$output    Pointer to output array
*   @param  array   &$svc_msg   Unused
*   @return integer             Status code
*/
function service_genButton_paypal($args, &$output, &$svc_msg)
{
    global $_CONF, $_PP_CONF;
    $btn_type = isset($args['btn_type']) ? $args['btn_type'] : '';
    $output = array();
    // Create the immediate purchase button, if requested.  As soon as a
    // gateway supplies the requested button type, break from the loop.
    if (!empty($btn_type)) {
        PAYPAL_loadGateways();
        // load all gateways
        if (!empty($_PP_CONF['gateways'])) {
            // Should be at least one
            // Get the first gateway that supports the button type
            foreach ($_PP_CONF['gateways'] as $gw_info) {
                if (PaymentGw::Supports($btn_type, $gw_info) && PaymentGw::Supports('external', $gw_info) && class_exists($gw_info['id'])) {
                    $gw = new $gw_info['id']();
                    $output[] = $gw->ExternalButton($args, $btn_type);
                }
            }
        }
    }
    // Now create an add-to-cart button, if requested.
    if (isset($args['add_cart']) && $_PP_CONF['ena_cart'] == 1) {
        if (!isset($args['item_type'])) {
            $args['item_type'] = PP_PROD_VIRTUAL;
        }
        $T = new Template(PAYPAL_PI_PATH . '/templates');
        $T->set_file('cart', 'buttons/btn_add_cart.thtml');
        $T->set_var(array('item_name' => $args['item_name'], 'item_number' => $args['item_number'], 'short_description' => $args['short_description'], 'amount' => $args['amount'], 'pi_url' => PAYPAL_URL, 'item_type' => $args['item_type'], 'have_tax' => isset($args['tax']) ? 'true' : '', 'tax' => isset($args['tax']) ? $args['tax'] : 0, 'quantity' => isset($args['quantity']) ? $args['quantity'] : '', '_ret_url' => isset($args['_ret_url']) ? $args['_ret_url'] : ''));
        $output['add_cart'] = $T->parse('', 'cart');
    }
    return PLG_RET_OK;
}
开发者ID:NewRoute,项目名称:paypal,代码行数:57,代码来源:services.inc.php


示例7: generatePage

 public static function generatePage(&$tpl, &$session, &$account, &$mj)
 {
     $dbMgr = DbManager::getInstance();
     //Instancier le gestionnaire
     $db = $dbMgr->getConn('game');
     //Demander la connexion existante
     $maxMsg = 50;
     $nbrMsg = isset($_GET['hepage']) ? $maxMsg * ($_GET['hepage'] - 1) : 0;
     //Charger le perso
     $query = 'SELECT *' . ' FROM ' . DB_PREFIX . 'perso' . ' WHERE id=:id' . ' LIMIT 1;';
     $prep = $db->prepare($query);
     $prep->bindValue(':id', $_GET['id'], PDO::PARAM_INT);
     $prep->executePlus($db, __FILE__, __LINE__);
     $arr = $prep->fetch();
     $prep->closeCursor();
     $prep = NULL;
     $perso = new Member_Perso($arr);
     //Lister les messages du HE
     $heMsg = self::listMessages($nbrMsg, $maxMsg, $_GET['id']);
     $code = '';
     while ($msg = array_shift($heMsg)) {
         $tpl2 = new Template($account);
         $tpl2->set('MSG', $msg);
         $tpl2->set('SKIN_VIRTUAL_PATH', SITE_VIRTUAL_PATH);
         $code .= $tpl2->fetch($account->getSkinRemotePhysicalPath() . 'html/Mj/Perso/He_item.htm');
         unset($tpl2);
     }
     $tpl->set('HE_MESSAGES', $code);
     //Trouver les sur la taille du HE
     $heSize = self::calculateHeSize((int) $_GET['id']);
     $tpl->set('HE_SIZE', $heSize);
     $tpl->set('HE_MSGPERPAGE', $maxMsg);
     $tpl->set('HE_PAGE', isset($_GET['hepage']) ? (int) $_GET['hepage'] : 1);
     return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Mj/Perso/He.htm');
 }
开发者ID:FMaz008,项目名称:ccv4,代码行数:35,代码来源:He.php


示例8: disp

 function disp()
 {
     //定义模板
     $t = new Template('../template/basic');
     $t->set_file('f', 'upmorefile.html');
     $t->unknowns = "remove";
     $t->left_delimiter = "[#";
     //修改左边界符为[#
     $t->right_delimiter = "#]";
     //修改右边界符#]
     $t->set_block('f', 'mainlist', 'ml');
     //设置分类
     $t->set_var('ml');
     $inrs =& $this->dbObj->Execute('select * from ' . WEB_ADMIN_TABPOX . 'apparatus  where agencyid =' . $_SESSION["currentorgan"]);
     //echo 'select * from '.WEB_ADMIN_TABPOX.'roomgroup  where agencyid ='.$_SESSION["currentorgan"];
     while ($inrrs =& $inrs->FetchRow()) {
         $t->set_var($inrrs);
         $t->parse('ml', 'mainlist', true);
     }
     $inrs->Close();
     $t->set_var('add', $this->getAddStr('img'));
     $t->set_var('path', WEB_ADMIN_HTTPPATH . '/common/');
     $t->parse('out', 'f');
     $t->p('out');
 }
开发者ID:TonyWoo,项目名称:cmlerp,代码行数:25,代码来源:upmorefile_equip=.php


示例9: displayError

 public function displayError()
 {
     if (!ini_get('display_errors')) {
         return;
     }
     $messages = explode("\n", $this->message);
     $messages = array_map('trim', $messages);
     $messages = array_filter($messages, 'strlen');
     $messages = array_values($messages);
     $param = array("code" => $this->code, "messages" => $messages, "file" => $this->file, "line" => $this->line, "trace" => debug_backtrace());
     $template = new Template();
     // set template
     $template->assign_vars($param);
     // load template
     if (!self::$template_filename) {
         self::$template_filename = dirname(__FILE__) . '/../../component/view/Exception.tpl';
     }
     if ($template->load(self::$template_filename)) {
         $html = $template->get_display_template(true);
     } else {
         throw new PMPException('Sysmtem Error ' . __CLASS__ . ' ' . __LINE__);
     }
     print $html;
     exit;
 }
开发者ID:ateliee,项目名称:pmp,代码行数:25,代码来源:PMPException.php


示例10: html

 public function html()
 {
     $content = null;
     if (!$this->totalItems) {
         return $content;
     }
     $numberOfPages = ceil($this->totalItems / $this->itemsPerPage);
     if ($numberOfPages == 1) {
         return $content;
     }
     $onFirstPage = $this->currentPage == 1;
     $onLastPage = $this->currentPage == $numberOfPages;
     $pageLinks = array();
     if (!$onFirstPage) {
         $pageLinks[] = array('id' => $this->currentPage - 1, 'title' => _('Previous'));
     }
     for ($i = 1; $i <= $numberOfPages; ++$i) {
         $isCurrentPage = (int) ($i == $this->currentPage);
         $pageLinks[] = array('id' => $i, 'title' => $i, 'active' => $isCurrentPage);
     }
     if (!$onLastPage) {
         $pageLinks[] = array('id' => $this->currentPage + 1, 'title' => _('Next'));
     }
     $template = new Template('parts/paging');
     $template->assign('pageLinks', $pageLinks);
     return $template->fetch();
 }
开发者ID:robkaper,项目名称:kiki,代码行数:27,代码来源:paging.php


示例11: loadTemplate

 protected function loadTemplate()
 {
     $modal = new \Modal('edit-file-form');
     $this->template = new \Template();
     $this->template->setModuleTemplate('filecabinet', 'FC_Forms/folders.html');
     $this->template->add('modal', $modal->get());
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:7,代码来源:FC_Folder_Factory.php


示例12: lateral_menu

function lateral_menu()
{
    global $LANG, $CONFIG;
    $tpl = new Template('admin/menus/panel.tpl');
    $tpl->assign_vars(array('L_MENUS_MANAGEMENT' => $LANG['menus_management'], 'L_ADD_CONTENT_MENUS' => $LANG['menus_content_add'], 'L_ADD_LINKS_MENUS' => $LANG['menus_links_add'], 'L_ADD_FEED_MENUS' => $LANG['menus_feed_add'], 'L_MANAGE_THEME_COLUMNS' => $LANG['manage_theme_columns'], 'THEME_NAME' => get_utheme()));
    $tpl->parse();
}
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:7,代码来源:lateral_menu.php


示例13: formAction

 /**
  * Handle form action
  */
 protected function formAction()
 {
     switch ($this->s->action) {
         case 'reload':
             // element: submenu
             $this->s->resetParams('form');
             $module = $this->s->loadModule($this->s->controller);
             $tpl = new Template('system');
             $tpl->assign('subnav', $this->generateNav($module->getSection()));
             $tpl->display('submenu.html');
             return true;
             break;
         case 'submenu':
             if ($this->s->element == '') {
                 Error::addWarning('Fehler: ID des Untermenüs ist nicht definiert!');
                 return false;
             }
             $section = str_replace('nav_', '', $this->s->element);
             $this->s->resetParams();
             $tpl = new Template('system');
             $tpl->assign('subnav', $this->generateNav($section));
             $tpl->display('submenu.html');
             return true;
             break;
         case 'cleanlog':
             if ($this->s->element == 'error') {
                 $file = fopen("logs/error.log", "w+");
                 fclose($file);
             }
             return true;
             break;
     }
 }
开发者ID:anhvn,项目名称:pokerspot,代码行数:36,代码来源:backend.class.php


示例14: jkbanners_display_banners

function jkbanners_display_banners($atts)
{
    $a = shortcode_atts(array('id' => false, 'filter_menu_order' => false, 'template' => 'list'), $atts);
    $output = array();
    //
    $banners = array();
    $banners = Banner::getAll();
    if ($a['filter_menu_order']) {
        foreach ($banners as $bk => $banner) {
            if ($banner->post->menu_order != $a['filter_menu_order']) {
                unset($banners[$bk]);
            }
        }
    }
    //
    $bannerTemplate = new Template();
    //One random banner
    if ($a['template'] == 'random-single') {
        //get a random item
        $banner = $banners[array_rand($banners)];
        //show single banner
        $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/single.php', array('banner' => $banner));
        $output[] = $bannerTemplateResponse;
    }
    //List all banners
    if ($a['template'] == 'list') {
        $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/list.php', array('banners' => $banners));
        $output[] = $bannerTemplateResponse;
    }
    //
    $output = implode("\n", $output);
    return $output;
}
开发者ID:kilrizzy,项目名称:WP-JK-Banners,代码行数:33,代码来源:jk-banners.php


示例15: smarty_function_render

/**
 * Campsite render function plugin
 *
 * Type:     function
 * Name:     render
 * Purpose:  template rendering
 *
 * @param array
 *     $p_params
 * @param object
 *     $p_smarty The Smarty object
 *
 * @return
 *     rendered content
 */
function smarty_function_render($p_params, &$p_smarty)
{
    if (empty($p_params['file'])) {
        return null;
    }
    $smarty = clone $p_smarty;
    if (SystemPref::Get('TemplateCacheHandler')) {
        $campsiteVector = $smarty->campsiteVector;
        foreach ($campsiteVector as $key => $value) {
            if (isset($p_params[$key])) {
                if (empty($p_params[$key])) {
                    $campsiteVector[$key] = null;
                }
                if (is_int($p_params[$key])) {
                    $campsiteVector[$key] = $p_params[$key];
                }
            }
        }
        if (isset($p_params['params'])) {
            $campsiteVector['params'] = $p_params['params'];
        }
        $smarty->campsiteVector = $campsiteVector;
        if (empty($p_params['cache'])) {
            $template = new Template($p_params['file']);
            $smarty->cache_lifetime = (int)$template->getCacheLifetime();
        } else {
            $smarty->cache_lifetime = (int)$p_params['cache'];
        }
    }
    return $smarty->display($p_params['file']);

} // fn smarty_function_render
开发者ID:nistormihai,项目名称:Newscoop,代码行数:47,代码来源:function.render.php


示例16: renderTemplate

/**
 * 编译模板文件,并且返回模板文件的路径
 * @param $file
 * @return string
 */
function renderTemplate($module, $action = null)
{
    if (defined('TEMPLATE_EXT')) {
        $ext = TEMPLATE_EXT;
    } else {
        $ext = ".htm";
    }
    if (empty($action)) {
        $file = "{$module}";
    } else {
        $file = "{$module}/{$action}";
    }
    $tplfile = TEMPLATE_DIR . '/' . $file . $ext;
    if (!file_exists($tplfile)) {
        die("template file {$tplfile} not exists");
    }
    $objfile = TEMPLATE_DATA_DIR . '/' . $file . '.tpl.php';
    if (!file_exists($objfile) || filemtime($tplfile) > filemtime($objfile)) {
        if (!file_exists(TEMPLATE_DATA_DIR)) {
            mkdir(TEMPLATE_DATA_DIR, 0777, true);
        }
        if (!file_exists(dirname($objfile))) {
            mkdir(dirname($objfile), 0777, true);
        }
        $t = new Template();
        if ($t->complie($tplfile, $objfile) === false) {
            die('Cannot write to template cache.');
        }
    }
    return $objfile;
}
开发者ID:GameCrusherTechnology,项目名称:HeroTowerServer,代码行数:36,代码来源:Template.class.php


示例17: actionCreate

 /**
  * 新建模板
  * @author yongze
  */
 public function actionCreate($id)
 {
     $dsModel = $this->loadModel((int) $id, 'ds');
     $dbModel = $this->loadModel((int) $dsModel->database_id, 'db');
     $model = new Template('Create');
     $data = array();
     if (isset($_POST['Template'])) {
         if (isset($_POST['Template']['type'])) {
             $_POST['Template']['type'] = (int) $_POST['Template']['type'];
         }
         $model->attributes = $_POST['Template'];
         $model->dataset_id = (int) $dsModel->id;
         $model->dataset_name = $dsModel->name;
         if ($model->save()) {
             $this->addLog('template', $model->id, '添加新模板“' . $model->tpname . '”');
             Yii::app()->user->setFlash("success", "新建 <b>{$model->tpname}</b> 模板成功!");
         } else {
             $errorMsg = '';
             $errorErr = $model->getErrors();
             foreach ($errorErr as $value) {
                 $errorMsg .= "\t" . $value[0];
             }
             $errorMsg = trim($errorMsg, ',');
             Yii::app()->user->setFlash("error", $errorMsg);
         }
         $this->redirect(array('/Template/Index/' . $dsModel->id));
     }
     $data['dbModel'] = $dbModel;
     $data['dsModel'] = $dsModel;
     $data['model'] = $model;
     $data['datasetId'] = $id;
     $this->_getFieldsInfos($data['_txtfiled'], $id);
     $this->render('edit', $data);
 }
开发者ID:chenyongze,项目名称:d-a-m,代码行数:38,代码来源:TemplateController.php


示例18: GetPanel

 public static function GetPanel()
 {
     $tpl = new Template();
     $pages = Pages_Model::GetPages();
     $tpl->SetParam('pages', $pages);
     return $tpl->Fetch('templates/pages/pages-panel.tpl');
 }
开发者ID:pragmatos,项目名称:phpMVCAngular,代码行数:7,代码来源:view.inc.php


示例19: moderateComment

function moderateComment($id, $action, $fullUser)
{
    global $dbConnectionInfo;
    $toReturn = "";
    $act = false;
    if ($action == "approved") {
        $act = true;
    }
    $cmt = new Comment($dbConnectionInfo, "", $fullUser);
    $return = $cmt->moderate($id, $action);
    $toReturn = $return['page'];
    if ($return['page'] != "" && $act && $return['oldState'] == 'new') {
        // notify users
        $user = new User($dbConnectionInfo);
        $usersToNotify = $user->getUsersToNotify($toReturn, $id);
        $cmtInfo = $cmt->getInfo($id);
        $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $cmtInfo['product'];
        $template = new Template("./templates/newComment.html");
        $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $toReturn . "#" . $id, "text" => $cmtInfo['text'], "user" => $cmtInfo['name'], "productName" => $productTranslate));
        foreach ($usersToNotify as $key => $value) {
            $mail = new Mail();
            $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentApproved');
            $subject .= " [" . $toReturn . "]";
            $mail->Subject($subject);
            $mail->To($value);
            $mail->From(__EMAIL__);
            $mail->Body($confirmationMsg);
            $mail->Send();
            //$toReturn = "\nSEND to ".$value."user email='".$userEmail."'";
        }
    }
    return $toReturn;
}
开发者ID:aidanreilly,项目名称:documentation,代码行数:33,代码来源:moderate.php


示例20: generate_inner_html

 /** !!
  * Uses the template in this directory to compute the innerHTML for this module.
  *
  * @return A string used by {@see render()} which is passed for display.
  */
 function generate_inner_html()
 {
     $tpl = new Template(PA::$blockmodule_path . '/' . get_class($this) . "/center_inner_public.tpl", $this);
     $tpl->set("test_blob", PA::$login_user->get_profile_field("echo_test_module", "test_blob"));
     $inner_html = $tpl->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:12,代码来源:EchoTestModule.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TemplateEngine类代码示例发布时间:2022-05-23
下一篇:
PHP TempFSFile类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap