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


PHP Template::add方法代码示例

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


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

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

示例2: showResults

 public function showResults($electionId)
 {
     \Layout::addStyle('election', 'Admin/Report/style.css');
     $singleResults = Factory::getSingleResults($electionId);
     $multipleResults = Factory::getMultipleResults($electionId);
     $referendumResults = Factory::getReferendumResults($electionId);
     $template = new \Template();
     $template->add('single', $singleResults);
     $template->add('multiple', $multipleResults);
     $template->add('referendum', $referendumResults);
     $template->setModuleTemplate('election', 'Admin/Report/Results.html');
     return $template->get();
 }
开发者ID:AppStateESS,项目名称:election,代码行数:13,代码来源:Report.php

示例3: printFile

 public function printFile($id)
 {
     $db = \Database::newDB();
     $t = $db->addTable('documents');
     $t->addFieldConditional('id', (int) $id);
     $row = $db->selectOneRow();
     if (empty($row)) {
         return null;
     }
     $template = new \Template();
     $template->setModuleTemplate('filecabinet', 'FC_Forms/document_view.html');
     $template->add('title', $row['title']);
     $template->add('filepath', './filecabinet/' . $row['id']);
     return $template->get();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:15,代码来源:FC_Documents.php

示例4: printFile

 public function printFile($id)
 {
     $db = \Database::newDB();
     $t = $db->addTable('images');
     $t->addFieldConditional('id', (int) $id);
     $row = $db->selectOneRow();
     if (empty($row)) {
         return null;
     }
     $template = new \Template();
     $template->setModuleTemplate('filecabinet', 'FC_Forms/image_view.html');
     $template->add('title', $row['title']);
     $template->add('alt', $row['alt']);
     $template->add('filepath', $row['file_directory'] . $row['file_name']);
     return $template->get();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:FC_Images.php

示例5: render

 public function render()
 {
     $items = $this->products->get_latest_products($this->count);
     $html = new \Template('partials/sidebar/products.html.php');
     $html->add('products', $items);
     return $html;
 }
开发者ID:brosby,项目名称:non-MVC,代码行数:7,代码来源:Products.php

示例6: populateTemplate

 public function populateTemplate()
 {
     if (empty($this->template)) {
         throw new \Exception(t('Template not set'));
     }
     $this->template->add('pager_id', $this->getId());
     $this->template->add('pager_javascript', $this->getJavascript());
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:8,代码来源:Pager.php

示例7: access_denied

/**
 * Returns an access denied page.
 */
function access_denied()
{
    $tpl = new Template();
    $tpl->add('main', 'common/503');
    // FIXME: Does it exist?.
    $tpl->setTPL('page');
    // FIXME: What about TTLs.
    return $tpl->render();
}
开发者ID:bmiro,项目名称:speedcard,代码行数:12,代码来源:misc.inc.php

示例8: controller

function controller($args)
{
    $ucard = random_card();
    $card_name = t(ucard2words($ucard));
    $card_icon = ucard2html($ucard);
    $card_suit = ucard2suit($ucard);
    page_set_title("{$card_icon} {$card_name}");
    $tpl_params = ['card_name' => $card_name, 'card_icon' => $card_icon, 'card_suit' => $card_suit];
    $tpl = new Template();
    $tpl->add('main', 'blocks/speedcard', $tpl_params);
    $tpl->setTPL('page');
    return $tpl->render();
}
开发者ID:bmiro,项目名称:speedcard,代码行数:13,代码来源:speedcard.php

示例9: pager

 private function pager(\Request $request)
 {
     \Pager::prepare();
     $template = new \Template();
     $template->setModuleTemplate('pulse', 'pager.html');
     if (\Settings::get('pulse', 'allow_web_access')) {
         $template->add('button_class', 'btn-success');
         $template->add('button_status', 'Web Access Allowed');
         $template->add('button_icon', 'fa-check');
         $template->add('button_title', 'Pulse will process schedules via the web.');
     } else {
         $template->add('button_class', 'btn-danger');
         $template->add('button_status', 'Web Access Denied');
         $template->add('button_icon', 'fa-ban');
         $template->add('button_title', 'Pulse will not allow access via the web.');
     }
     return $template;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:18,代码来源:PulseAdminController.php

示例10: emailStudent

 private static function emailStudent(\election\Resource\Student $student, array $election)
 {
     if (STUDENT_DATA_TEST) {
         $email_address = TEST_STUDENT_EMAIL;
     } else {
         $email_address = $student->getEmail();
     }
     $transport = \Swift_MailTransport::newInstance();
     $template = new \Template();
     $template->setModuleTemplate('election', 'Admin/VoteSuccess.html');
     $template->add('title', $election['title']);
     $content = $template->get();
     $message = \Swift_Message::newInstance();
     $message->setSubject('Vote complete');
     $message->setFrom(\PHPWS_Settings::get('election', 'fromAddress'));
     $message->setTo($email_address);
     $message->setBody($content, 'text/html');
     $mailer = \Swift_Mailer::newInstance($transport);
     $mailer->send($message);
 }
开发者ID:AppStateESS,项目名称:election,代码行数:20,代码来源:Vote.php

示例11: parse

 /**
  * Parses the specified file $filename with an array $data.
  * Useful for parsing piece of code.
  *
  * @param   string  $filename
  * @param   array   $data
  * @return  string
  */
 function parse($filename, $data)
 {
     $tpl = new Template();
     foreach ($data as $k => $v) {
         $tpl->add($k, $v);
     }
     return $tpl->fetch($filename);
 }
开发者ID:jairobjunior,项目名称:cms_framework,代码行数:16,代码来源:SKTemplate.php

示例12: welcomeScreen

 public static function welcomeScreen()
 {
     \Layout::addStyle('election', 'User/style.css');
     $template = new \Template();
     $template->setModuleTemplate('election', 'User/welcome.html');
     if (!\Current_User::isLogged()) {
         $template->add('color', 'primary');
         $template->add('label', '<i class="fa fa-check-square-o"></i> Sign in to Vote');
         $template->add('url', ELECTION_LOGIN_DIRECTORY);
     } else {
         $template->add('color', 'success');
         $template->add('label', '<i class="fa fa-check-square-o"></i> Get started voting!');
         $template->add('url', 'election/');
     }
     $template->add('image', PHPWS_SOURCE_HTTP . 'mod/election/img/background1.jpg');
     \Layout::add($template->get());
 }
开发者ID:AppStateESS,项目名称:election,代码行数:17,代码来源:User.php

示例13: getMultipleResults

 public static function getMultipleResults($electionId)
 {
     $total_votes = Election::getTotalVotes($electionId);
     $multiples = Multiple::getListWithCandidates($electionId);
     if (empty($multiples)) {
         return null;
     }
     $votes = Vote::getMultipleVotes($electionId);
     if (empty($votes)) {
         return 'No multiple chair votes recorded.';
     }
     $total_cast_votes = array();
     foreach ($votes as $v) {
         $key = $v['multipleId'];
         if (!isset($total_cast_votes[$key])) {
             $total_cast_votes[$key] = 0;
         }
         $total_cast_votes[$key] += $v['votes'];
         $sorted_votes[$key][$v['candidateId']] = $v['votes'];
     }
     foreach ($multiples as $ballot) {
         $ballot_row['title'] = $ballot['title'];
         $ballot_row['seats'] = $ballot['seatNumber'];
         $candidates = array();
         foreach ($ballot['candidates'] as $c) {
             if (isset($sorted_votes[$ballot['id']][$c['id']])) {
                 $vote = $sorted_votes[$ballot['id']][$c['id']];
                 $template = new \Template();
                 $template->setModuleTemplate('election', 'Admin/Report/Candidate.html');
                 $template->add('name', $c['firstName'] . ' ' . $c['lastName']);
                 $percentage = round($vote / $total_cast_votes[$ballot['id']] * 100, 1);
                 $template->add('vote', "{$vote} ({$percentage}%)");
                 $template->add('picture', $c['picture']);
                 $candidates[$vote . '.' . $c['id']] = $template->get();
             }
         }
         if (!empty($candidates)) {
             krsort($candidates);
             $ballot_row['candidates'] = implode("\n", $candidates);
         } else {
             $ballot_row['candidates'] = self::noCandidateVotes();
         }
         $tpl['ballots'][] = $ballot_row;
     }
     $template = new \Template();
     $template->addVariables($tpl);
     $template->setModuleTemplate('election', 'Admin/Report/Multiple.html');
     return $template->get();
 }
开发者ID:AppStateESS,项目名称:election,代码行数:49,代码来源:Report.php

示例14: autoloader

//require_once("libs/lib_template.php");
//require_once("libs/lib_item.php");
//require_once("libs/lib_game.php");
function autoloader($classname)
{
    if (file_exists("libs/" . strtolower($classname) . ".class.php")) {
        require_once "libs/" . strtolower($classname) . ".class.php";
    }
}
spl_autoload_register("autoloader");
$controler = GET('action', GET('a'));
if ($controler == "") {
    $controler = "index";
}
$run = GET('subaction', GET('s'));
if ($run == "") {
    $run = "run";
}
if (!file_exists('controler/' . $controler . '.controler.php')) {
    $controler = 'error';
}
include 'controler/' . $controler . '.controler.php';
$controler = $controler . "_controler";
$c = new $controler();
$templ = new Template();
$templ->add("title", $CONFIG['Title']);
if (!is_callable(array($controler, $run))) {
    $run = "run";
}
$c->{$run}($templ);
$templ->run();
开发者ID:Woems,项目名称:TerminGrul,代码行数:31,代码来源:index.php

示例15: confirmWinner

 private function confirmWinner()
 {
     $game = \tailgate\Factory\Game::getCurrent();
     $hash = filter_input(INPUT_GET, 'hash', FILTER_SANITIZE_STRING);
     $template = new \Template();
     $factory = new Factory();
     $template->setModuleTemplate('tailgate', 'User/confirmation.html');
     $template->add('button_color', 'primary');
     if ($game->getPickupDeadline() < time()) {
         $template->add('message_color', 'danger');
         $template->add('message', 'Sorry, the confirmation deadline for this lottery has passed.');
         $template->add('url', \Server::getSiteUrl());
         $template->add('label', 'Go back to home page');
         $content = $template->get();
         return $content;
     }
     $confirm = $factory->confirm($hash);
     if ($confirm) {
         $template->add('message_color', 'success');
         $template->add('message', 'Lottery win confirmed!');
         if (!\Current_User::isLogged()) {
             $template->add('url', \Server::getSiteUrl() . 'admin/');
             $template->add('label', 'Log in to pick your lot');
         } else {
             $template->add('url', \Server::getSiteUrl() . 'tailgate/');
             $template->add('label', 'Go to your status page and pick a spot');
         }
     } else {
         $template->add('message_color', 'danger');
         $template->add('message', 'Sorry, could not confirm your lottery win. Contact us if you are having trouble.');
         $template->add('url', \Server::getSiteUrl());
         $template->add('label', 'Go back to home page');
     }
     $content = $template->get();
     return $content;
 }
开发者ID:AppStateESS,项目名称:tailgate,代码行数:36,代码来源:Lottery.php


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