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


PHP Template::set方法代码示例

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


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

示例1: addslashes

 function event_ExecuteEditor(&$data)
 {
     global $lang, $manager;
     if ($data['sheet'] == 'background') {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $res = sql::query("\r\n\t\t\t\t\t\tREPLACE INTO \r\n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_background\r\n\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\tID='" . $data['params']['id'] . "', \r\n\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\r\n\t\t\t\t\t\t\timage='" . addslashes($_REQUEST['image']) . "', \r\n\t\t\t\t\t\t\tmodified=NOW()\r\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') . "/background?revision=" . $data['params']['revision']);
             exit;
         }
         $res = sql::query("\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t* \r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_background\r\n\t\t\t\t\tWHERE \r\n\t\t\t\t\t\tid='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t");
         if ($row = sql::fetch_array($res)) {
             $image = $row['image'];
         } else {
             $image = '';
         }
         $tpl = new Template($this->getTemplate('editor.template'));
         $tpl->set('id', $data['params']['id']);
         $tpl->set('revision', $data['params']['revision']);
         $tpl->set('image', $image);
         $data['template']->append('content', $tpl->fetch());
         // Make sure the following assets are included
         $data['page']->assets->registerJavascript('/core/assets/javascript/modaldialog.js');
         $data['page']->assets->registerCSS($this->localAsset('editor.css'));
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:27,代码来源:plugin.php

示例2: simple_pa_mail

/**
 * Function to send email where the container is specified but not the email template.
 * 
 */
function simple_pa_mail($to, $subject, $message, $from = DEFAULT_SENDER, $container_html = 'default_email_container.tpl')
{
    if (empty($from)) {
        $from = DEFAULT_SENDER;
    }
    // patching up message and subject in the email container
    if (!empty($container_html)) {
        $email_container = new Template('config/email_containers/' . $container_html);
        $email_container->set('subject', $subject);
        $email_container->set('message', $message);
        // actual message to be sent through the mail
        $message = $email_container->fetch();
    }
    $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=iso-8859-1\r\n" . "From: {$from}";
    // if you want to test the e-mail system, set global
    // $mail_testing_callback to point to your own function, that
    // behaves like mail().
    global $mail_testing_callback;
    $mail_func = $mail_testing_callback ? $mail_testing_callback : "mail";
    $check = call_user_func($mail_func, $to, $subject, $message, $headers);
    if ($check == FALSE) {
        throw new PAException(MAIL_FUNCTION_FAILED, "Mail is not sent due to some internal server problem");
    } else {
        return TRUE;
    }
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:30,代码来源:mailing.php

示例3: Template

 function generate_inner_html()
 {
     $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/side_inner_public.tpl';
     $inner_html_gen = new Template($inner_template);
     $inner_html_gen->set('flag', $this->flag);
     $inner_html_gen->set('percentage', @$this->option_precent);
     $inner_html_gen->set('vote_count', @$this->option_vote_count);
     $inner_html_gen->set('topic', $this->topic);
     $inner_html_gen->set('total_vote', $this->total_vote_count);
     $inner_html_gen->set('options', $this->options);
     $inner_html_gen->set('cnt_prev', $this->cnt_prev);
     $inner_html_gen->set('gid', $this->gid);
     $url = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : '';
     $query = isset($_SERVER['REDIRECT_QUERY_STRING']) ? $_SERVER['REDIRECT_QUERY_STRING'] : '';
     parse_str($query, $query_vars);
     if (!isset($query_vars['show_poll_results'])) {
         $query_vars['show_poll_results'] = 'true';
     }
     if ($this->flag == 0) {
         $inner_html_gen->set('show_results_link', $url . (http_build_query($query_vars) != '' ? '?' . http_build_query($query_vars) : ''));
     } else {
         $inner_html_gen->set('show_results_link', '');
     }
     if (!$this->previous_vote_detected && $this->flag == 1) {
         unset($query_vars['show_poll_results']);
         $inner_html_gen->set('show_poll_link', $url . (http_build_query($query_vars) != '' ? '?' . http_build_query($query_vars) : ''));
     } else {
         $inner_html_gen->set('show_poll_link', '');
     }
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:32,代码来源:PollModule.php

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

示例5: array

 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

示例6: addslashes

 function event_ExecuteEditor(&$data)
 {
     global $lang, $manager;
     if ($data['type'] == 'external' && $data['sheet'] == 'external') {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if ($_REQUEST['url'] != 'http://') {
                 $res = sql::query("\r\n\t\t\t\t\t\t\tREPLACE \r\n\t\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_external\r\n\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\tID='" . $data['params']['id'] . "',\r\n\t\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\r\n\t\t\t\t\t\t\t\turl='" . addslashes($_REQUEST['url']) . "'\r\n\t\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') . "/external?revision=" . $data['params']['revision']);
             exit;
         }
         $res = sql::query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t*\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_external\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t");
         $tpl = new Template($this->getTemplate('editor.template'));
         if ($row = sql::fetch_array($res)) {
             $tpl->set("url", $row['url']);
         } else {
             $tpl->set("url", 'http://');
         }
         $tpl->set("id", $data['params']['id']);
         $tpl->set("revision", $data['params']['revision']);
         $data['template']->append('content', $tpl->fetch());
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:25,代码来源:plugin.php

示例7: Template

 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

示例8: testContainsKey

 /**
  * @covers Template::containsKey
  */
 public function testContainsKey()
 {
     $key = "class";
     $value = "errorCall";
     $this->object->set($key, $value);
     $this->assertTrue($this->object->containsKey($key));
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:10,代码来源:TemplateTest.php

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

示例10: explode

 function generate_inner_html()
 {
     if (empty($this->links)) {
         return "";
     }
     $links = $this->links;
     /*
      if ($links->type == 'textpad') {
      $this->title = $links->title;
      }
     */
     $pos = explode(',', $links->orientation);
     $x_loc = $pos[0];
     if ($x_loc == 2) {
         $width = AD_WIDTH_MIDDLE;
         //$height = AD_HEIGHT_MIDDLE;
     } else {
         $width = AD_WIDTH_LR;
         //$height = AD_HEIGHT_LR;
         $this->outer_template = 'cnmodule_advertisement.php';
     }
     // we never want to reduce the height of an ad, so we set $height very high
     $height = 1000;
     $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule.php';
     $inner_html_gen = new Template($tmp_file);
     $inner_html_gen->set_object('links', $links);
     $inner_html_gen->set('width', $width);
     $inner_html_gen->set('height', $height);
     $inner_html_gen->set('block_name', $this->html_block_id);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:32,代码来源:CNAdvertisementModule.php

示例11: Template

 function content_horizontal(&$data)
 {
     global $manager, $tree, $user;
     if ($item =& $tree->getItemById($data['params']['id'])) {
         if (!$item['visible']) {
             return;
         }
         $tpl = new Template($this->getTemplate('main.template', $data['type']));
         if (intval($item['parent']) > 0) {
             $parent =& $tree->getItemById($item['parent']);
             $list =& $parent['children'];
         } else {
             $list =& $GLOBALS['tree']->tree;
         }
         $prev = null;
         reset($list);
         while (list($k, ) = each($list)) {
             if ($list[$k]['id'] == $item['id']) {
                 if ($prev) {
                     $tpl->set('prev', $prev);
                 }
                 if (list($k, ) = each($list)) {
                     $tpl->set('next', $list[$k]);
                 }
                 break;
             }
             $prev = $list[$k];
         }
         $data['page']->composite->set('horizontal', $tpl->fetch());
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:31,代码来源:plugin.php

示例12: switch

 function generate_inner_html()
 {
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_html.tpl';
     }
     if (!empty($this->profile_feeds)) {
         $counter = 0;
         foreach ($this->profile_feeds as $data) {
             $params = array('feed_id' => $data['feed_id']);
             $ExternalFeed = new ExternalFeed();
             try {
                 //Getting the feed data corresponding to the feed id
                 $this->profile_feeds[$counter]['links'] = $ExternalFeed->get_feed_data($params);
             } catch (PAException $e) {
                 //TODO: pending error handling if function fails.
                 //$error = $e->message;
             }
             $counter++;
         }
     }
     $inner_html_gen = new Template($inner_template);
     $inner_html_gen->set('profile_feeds', @$this->profile_feeds);
     $inner_html_gen->set('feed_id', $this->feed_id);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:28,代码来源:ViewFeedsModule.php

示例13: Pagination

 function generate_inner_html()
 {
     $Pagination = new Pagination();
     $Pagination->setPaging($this->Paging);
     $this->page_prev = $Pagination->getPreviousPage();
     $this->page_next = $Pagination->getNextPage();
     $this->page_links = $Pagination->getPageLinks();
     $inner_template = NULL;
     switch ($this->mode) {
         case 'relations':
         case 'in_relations':
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
             break;
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
     }
     $obj_inner_template = new Template($inner_template, $this);
     $obj_inner_template->set_object('links', $this->links);
     $obj_inner_template->set_object('gid', @$this->gid);
     $obj_inner_template->set('sub_title', @$this->sub_title);
     $obj_inner_template->set('total', $this->Paging['count']);
     $obj_inner_template->set('reciprocated_relationship_set', @$this->reciprocated_relationship_set);
     $obj_inner_template->set('relations', @$this->relations);
     $obj_inner_template->set('in_relations', @$this->in_relations);
     $obj_inner_template->set('user_name', $this->page_user);
     $obj_inner_template->set('page_prev', $this->page_prev);
     $obj_inner_template->set('page_next', $this->page_next);
     $obj_inner_template->set('page_links', $this->page_links);
     $obj_inner_template->set('view_type', $this->view_type);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:32,代码来源:FaceBookModule.php

示例14: Template

 function generate_inner_html()
 {
     $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content.php';
     $inner_html_gen = new Template($tmp_file);
     $inner_html_gen->set('link_categories_array', $this->get_link_categories());
     $inner_html_gen->set('config_navigation_url', network_config_navigation('manage_link'));
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:9,代码来源:CNNetworkLinkModule.php

示例15: header

 function action_move($args)
 {
     global $manager, $tree, $user, $lang;
     /* Decode argumenst */
     $id = array_shift($args);
     $item =& $tree->getItemById($id);
     $id = $item['id'];
     if (!$tree->_hasRights('admin', $item['rights'])) {
         header('Location: ' . url::item($id));
         exit;
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $parentid = intval($_POST['parent']);
         $position = 0;
         if ($parentid == 0) {
             reset($tree->tree);
             while (list($k, ) = each($tree->tree)) {
                 if ($tree->tree[$k]['id'] != 'admin') {
                     $position = max($position, $tree->tree[$k]['position']);
                 }
             }
         } else {
             if ($parent =& $tree->getItemById($parentid)) {
                 if (isset($parent['children'])) {
                     reset($parent['children']);
                     while (list($k, ) = each($parent['children'])) {
                         $position = max($position, $parent['children'][$k]['position']);
                     }
                 }
             }
         }
         $position++;
         treeStorage::startTransaction();
         treeStorage::prepareForMove($id, $parentid, $_POST['language']);
         sql::query("\r\n\t\t\t\t\tUPDATE \r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents\r\n\t\t\t\t\tSET \r\n\t\t\t\t\t\t`parent`='" . $parentid . "',\r\n\t\t\t\t\t\t`position`=" . $position . "\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t`ID`='" . $id . "'\r\n\t\t\t\t");
         treeStorage::stopTransaction();
         // Our url needs to be rebuild...
         $url = url::item($id);
         $url = str_replace('/' . $item['meta']['language'] . '/', '/' . $_POST['language'] . '/', $url);
         header("Location: " . $url);
         exit;
     } else {
         @(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 = new Template($this->getTemplate('move.template'));
         $tpl->set('languages', $languages);
         $tpl->set('id', $id);
         echo $tpl->fetch();
         exit;
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:57,代码来源:plugin.php


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