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


PHP Template::assign方法代码示例

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


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

示例1: createRequest

 /**
  * Create new request and sends email to user
  * @static
  * @param string Mail adress
  * @throws MailFailureException, UserNotFoundException
  */
 public static function createRequest($mail)
 {
     LostPW::cleanUp();
     $user = User::find('email', $mail);
     if ($user == NULL) {
         throw new UserNotFoundException();
     }
     // Delete old requests
     $sql = System::getDatabase()->prepare('DELETE FROM lostpw WHERE user_ID = :uid');
     $sql->execute(array(':uid' => $user->uid));
     // Create new request
     $hash = LostPW::createHash();
     $sql = System::getDatabase()->prepare('INSERT INTO lostpw (user_ID, hash, time) VALUES (:uid, :hash, :time)');
     $sql->execute(array(':uid' => $user->uid, ':hash' => $hash, ':time' => time()));
     // Send Mail
     $content = new Template();
     $content->assign('link', Router::getInstance()->build('AuthController', 'lostpw_check', array('hash' => $hash)));
     $content->assign('user', $user);
     $content->assign('title', System::getLanguage()->_('LostPW'));
     // Determine template file
     $tpl = 'mails/lostpw.' . LANGUAGE . '.tpl';
     foreach ($content->getTemplateDir() as $dir) {
         $file = 'mails/lostpw.' . $user->lang . '.tpl';
         if (file_exists($dir . $file)) {
             $tpl = $file;
             break;
         }
     }
     $mail = new Mail(System::getLanguage()->_('LostPW'), $content->fetch($tpl), $user);
     $mail->send();
 }
开发者ID:nicefirework,项目名称:sharecloud,代码行数:37,代码来源:LostPW.class.php

示例2: index

 public function index()
 {
     $user = System::getUser();
     $form = new Form('form-profile');
     $form->setAttribute('data-noajax', 'true');
     $form->binding = $user;
     $fieldset = new Fieldset(System::getLanguage()->_('General'));
     $firstname = new Text('firstname', System::getLanguage()->_('Firstname'));
     $firstname->binding = new Databinding('firstname');
     $lastname = new Text('lastname', System::getLanguage()->_('Lastname'));
     $lastname->binding = new Databinding('lastname');
     $email = new Text('email', System::getLanguage()->_('EMail'), true);
     $email->binding = new Databinding('email');
     $email->blacklist = $this->getListOfMailAdresses($user);
     $email->error_msg[4] = System::getLanguage()->_('ErrorMailAdressAlreadyExists');
     $language = new Radiobox('lang', System::getLanguage()->_('Language'), L10N::getLanguages());
     $language->binding = new Databinding('lang');
     $fieldset->addElements($firstname, $lastname, $email, $language);
     $form->addElements($fieldset);
     $fieldset = new Fieldset(System::getLanguage()->_('Password'));
     $password = new Password('password', System::getLanguage()->_('Password'));
     $password->minlength = PASSWORD_MIN_LENGTH;
     $password->binding = new Databinding('password');
     $password2 = new Password('password2', System::getLanguage()->_('ReenterPassword'));
     $fieldset->addElements($password, $password2);
     $form->addElements($fieldset);
     $fieldset = new Fieldset(System::getLanguage()->_('Settings'));
     $quota = new Text('quota', System::getLanguage()->_('Quota'));
     if ($user->quota > 0) {
         $quota->value = System::getLanguage()->_('QuotaAvailabe', Utils::formatBytes($user->getFreeSpace()), Utils::formatBytes($user->quota));
     } else {
         $quota->value = System::getLanguage()->_('Unlimited');
     }
     $quota->readonly = true;
     $fieldset->addElements($quota);
     $form->addElements($fieldset);
     if (Utils::getPOST('submit', false) !== false) {
         if (!empty($password->value) && $password->value != $password2->value) {
             $password2->error = System::getLanguage()->_('ErrorInvalidPasswords');
         } else {
             if ($form->validate()) {
                 $form->save();
                 System::getUser()->save();
                 System::getSession()->setData('successMsg', System::getLanguage()->_('ProfileUpdated'));
                 System::forwardToRoute(Router::getInstance()->build('ProfileController', 'index'));
                 exit;
             }
         }
     } else {
         $form->fill();
     }
     $form->setSubmit(new Button(System::getLanguage()->_('Save'), 'floppy-disk'));
     $smarty = new Template();
     $smarty->assign('title', System::getLanguage()->_('MyProfile'));
     $smarty->assign('heading', System::getLanguage()->_('MyProfile'));
     $smarty->assign('form', $form->__toString());
     $smarty->display('form.tpl');
 }
开发者ID:nicefirework,项目名称:sharecloud,代码行数:58,代码来源:ProfileController.class.php

示例3: FirstPage

 function FirstPage()
 {
     $query = "SELECT arts.id,arts.title FROM wb_articles AS arts\n                       JOIN wb_weblogs AS blogs ON(arts.weblog_id= blogs.id)\n\t\t       JOIN ge_subdomains as sub\n\t\t\t    ON(sub.site_id=blogs.site_id)\n                       WHERE sub.sub_domain='{$this->newsSub}'\n                       LIMIT 0,10";
     $newsPosts = $this->db->query($query)->fetchAll();
     $tmpl = new Template('frontPage.tpl');
     $query = "SELECT\n\t\t        blogs.title,\n\t\t\tsub.sub_domain\n\t\t    FROM wb_articles AS arts\n                    JOIN wb_weblogs AS blogs\n\t\t\tON(arts.weblog_id= blogs.id)\n\t\t    JOIN ge_subdomains as sub\n\t\t\tON(sub.site_id=blogs.site_id)\n\t\t    GROUP BY\n\t\t\tblogs.id\n\t\t    ORDER BY\n\t\t\tarts.`date` DESC\n\t\t    LIMIT 0,10";
     $newArt = $this->db->query($query)->fetchAll();
     $tmpl->assign('news', $newsPosts);
     $tmpl->assign('updates', $newArt);
     $tmpl->assign('subdomain', $this->newsSub);
     $tmpl->loadPage('firstPage');
     $this->reponse->setTemplate($tmpl);
 }
开发者ID:redknight,项目名称:frot,代码行数:13,代码来源:SiteService.php

示例4: index

function index()
{
    global $db, $lang, $prefix;
    include "header.php";
    $result = $db->query("SELECT *\tFROM  " . $prefix . "_fares WHERE  fare_special=1 AND fare_active=1 ORDER BY fare_id");
    $tpl = new Template();
    $tpl->modTemplate("special");
    $num_record = $db->row_count($result);
    if (isset($_GET['page'])) {
        $page = intval($_GET['page']);
    } else {
        $page = 1;
    }
    $currentpage = $page;
    $perpage = 20;
    $start = ($page - 1) * $perpage;
    $pages = ceil($num_record / $perpage);
    $starting_no = $start + 1;
    if ($num_record - $start < $perpage) {
        $end_count = $num_record;
    } elseif ($num_record - $start >= $perpage) {
        $end_count = $start + $perpage;
    }
    if ($pages > 1) {
        $page_link = makepagelink("index.php?m=special", $page, $pages);
    } else {
        $page_link = "";
    }
    // Fix the problem
    $result = $db->query("SELECT *\tFROM  " . $prefix . "_fares WHERE  fare_special=1 AND fare_active=1  ORDER BY fare_id DESC\n\n\tLIMIT {$start},{$perpage}");
    $found = $db->row_count($result);
    $tpl->assign("found", $found);
    $tpl->assign("lang", $lang);
    $tpl->assign("pagelink", $page_link);
    $tpl->assign("start", $starting_no);
    $tpl->assign("end", $end_count);
    $tpl->assign("found", $found);
    $tpl->assign("currentpage", $currentpage);
    while ($row = $db->fetch_array($result)) {
        $special[] = $row;
        $tpl->assign("date", "" . todate($row[fare_purchaseby]) . "");
        $q = $db->query("SELECT * from travel_airline WHERE airline_id={$row['fare_airline']}");
        $airline = $db->fetch_array($q);
        $tpl->assign("airline", $airline);
        $tpl->assign("special", $special);
    }
    $tpl->display("specialindex.tpl");
    include "footer.php";
}
开发者ID:bogiesoft,项目名称:TravelAgentv2,代码行数:49,代码来源:index.php

示例5: alertstatus

 /**
  * Put your own methods below this...
  */
 function alertstatus()
 {
     $this->auth->check_access('site/settings', TRUE);
     /* load models */
     $this->load->model('alertstatus_model', 'alert');
     $alerts = $this->alert->get_alerts();
     if ($alerts->num_rows() > 0) {
         foreach ($alerts->result() as $alert) {
             $imgstat = 'off';
             if ($alert->alert_active == 'y') {
                 $imgstat = 'on';
             }
             $data['alerts'][$alert->alert_id] = array('img' => array('src' => Location::asset('images/alerts', $alert->alert_image . '-' . $imgstat . '.png'), 'alt' => $alert->alert_name, 'class' => $imgstat, 'currStat' => $alert->alert_image, 'id' => 'al' . $alert->alert_id), 'name' => $alert->alert_name, 'desc' => $alert->alert_description, 'active' => $alert->alert_active, 'id' => $alert->alert_id, 'imgbase' => $alert->alert_image);
             $data_js['img'][$alert->alert_id] = array('src' => $alert->alert_image . '-hover.png', 'id' => $alert->alert_id);
         }
     }
     $data['loading'] = array('src' => Location::asset('images/alerts', 'black-bg-loading.gif'), 'alt' => '', 'class' => 'image');
     $data['imglocation'] = base_url() . Location::asset('images/alerts', '');
     $data['activealert'] = $this->alert->get_current_alert();
     $data['header'] = 'Alert Status';
     $data['text'] = 'Set the current alert status of your ship by clicking on the proper alert claxon.';
     $this->_regions['content'] = Location::view('admin_alertstatus', $this->skin, 'admin', $data);
     $this->_regions['javascript'] = Location::js('admin_alertstatus_js', $this->skin, 'admin');
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }
开发者ID:rajeltomari,项目名称:Sim-Alert,代码行数:30,代码来源:admin.php

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

示例7: modmanifest

 public function modmanifest()
 {
     // load the models
     if (isset($_POST['submit'])) {
         $showSpecies = $this->input->post('chkShowSpecies', true);
         $showGender = $this->input->post('chkShowGender', true);
         $showThumbnail = $this->input->post('chkShowThumbnail', true);
         $setting_data = array('setting_value' => $showSpecies);
         $update_settings = $this->settings->update_setting('modManifest_show_species', $setting_data);
         $setting_data = array('setting_value' => $showGender);
         $update_settings = $this->settings->update_setting('modManifest_show_gender', $setting_data);
         $setting_data = array('setting_value' => $showThumbnail);
         $update_settings = $this->settings->update_setting('modManifest_show_thumbnail', $setting_data);
         $message = "Settings updated sucessfully.";
         $flash['status'] = 'success';
         $flash['message'] = text_output($message);
     }
     $data['checkboxes']['show_species'] = array('name' => 'chkShowSpecies', 'id' => 'chkShowSpecies', 'value' => 'true');
     $data['checkboxes']['show_gender'] = array('name' => 'chkShowGender', 'id' => 'chkShowGender', 'value' => 'true');
     $data['checkboxes']['show_thumbnail'] = array('name' => 'chkShowThumbnail', 'id' => 'chkShowThumbnail', 'value' => 'true');
     $set_species = $this->settings->get_setting('modManifest_show_species');
     $set_gender = $this->settings->get_setting('modManifest_show_gender');
     $set_thumbnail = $this->settings->get_setting('modManifest_show_thumbnail');
     $data['temp'] = $set_species;
     $data['checkboxes']['show_species']['checked'] = $set_species;
     $data['checkboxes']['show_gender']['checked'] = $set_gender;
     $data['checkboxes']['show_thumbnail']['checked'] = $set_thumbnail;
     $data['submit'] = array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'content' => ucwords(lang('actions_submit')));
     $data['header'] = "Manifest Details Configuration";
     $view_loc = "admin_modmanifest";
     $this->_regions['content'] = Location::view($view_loc, $this->skin, 'admin', $data);
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }
开发者ID:rajeltomari,项目名称:Manifest-Details,代码行数:35,代码来源:admin.php

示例8: render

 public function render()
 {
     if ($this->callback) {
         $callback = Cogear::prepareCallback($this->callback);
         $this->setValues(call_user_func($callback));
     }
     $this->setAttributes();
     $code = array();
     foreach ($this->values as $key => $value) {
         $attributes = $this->attributes;
         $attributes['value'] = $key;
         if ($key === $this->value) {
             $attributes['checked'] = 'checked';
         }
         $code[] = HTML::tag('input', $attributes) . $value;
     }
     $code = implode("<br/>", $code);
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->attributes);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
开发者ID:romartyn,项目名称:cogear,代码行数:25,代码来源:Radio.php

示例9: render

 /**
  *
  * @return type
  */
 public function render()
 {
     if ($this->callback) {
         $callback = new Callback($this->callback);
         if ($callback->check()) {
             $this->options->values = $callback->run(array($this->form));
         }
     }
     $this->prepareOptions();
     $code[] = HTML::open_tag('select', $this->options);
     foreach ($this->values as $key => $value) {
         $attributes = array();
         if ($this->value instanceof Core_ArrayObject) {
             $this->value = $this->value->toArray();
         }
         if (is_array($this->value)) {
             if (in_array($key, $this->value)) {
                 $attributes['selected'] = 'selected';
             }
         } elseif ($key == $this->value) {
             $attributes['selected'] = 'selected';
         }
         $attributes['value'] = $key;
         $code[] = HTML::paired_tag('option', $value, $attributes);
     }
     $code[] = HTML::close_tag('select');
     $code = implode("\n", $code);
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->options);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
开发者ID:brussens,项目名称:cogear2,代码行数:39,代码来源:Select.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: exitWithMessage

 public static function exitWithMessage($message_detail, $forward_url, $second = 3, $type = "message")
 {
     switch ($type) {
         case "success":
             $page_title = "操作成功!";
             break;
         case "error":
             $page_title = "错误!";
             break;
         default:
             $page_title = "嗯!";
             break;
     }
     $temp = explode('?', $forward_url);
     $file_url = $temp[0];
     if ($file_url[0] !== "/") {
         $file_url = '/' . $file_url;
         $forward_url = '/' . $forward_url;
     }
     $menu = MenuUrl::getMenuByUrl($file_url);
     $forward_title = "首页";
     if (sizeof($menu) > 0) {
         $forward_title = $menu['menu_name'];
     }
     if ($forward_url) {
         $message_detail = "{$message_detail} <script>setTimeout(\"window.location.href ='" . ADMIN_URL . "{$forward_url}';\", " . $second * 1000 . ");</script>";
     }
     Template::assign('type', $type);
     Template::assign('page_title', $page_title);
     Template::assign('message_detail', $message_detail);
     Template::assign('forward_url', $forward_url);
     Template::assign('forward_title', $forward_title);
     Template::Display('message.tpl');
     exit;
 }
开发者ID:leohdr,项目名称:OSAdmin,代码行数:35,代码来源:Common.class.php

示例12: render

 public function render()
 {
     if ($this->callback) {
         $callback = Callback::prepare($this->callback);
         is_callable($callback) && $this->setValues(call_user_func($callback));
     }
     $this->getAttributes();
     $code[] = HTML::open_tag('select', $this->attributes);
     foreach ($this->values as $key => $value) {
         $attributes = array();
         if ($key == $this->value) {
             $attributes['selected'] = 'selected';
         }
         $attributes['value'] = $key;
         $code[] = HTML::paired_tag('option', $value, $attributes);
     }
     $code[] = HTML::close_tag('select');
     $code = implode("\n", $code);
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->attributes);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
开发者ID:romartyn,项目名称:cogear,代码行数:26,代码来源:Select.php

示例13: tag

    public static function tag( $args ) {

        $tag = str_replace('_', ' ', urldecode($args[0]));
        
        $filtred = array();
        $post  = ModelHandler::get("Posts");
        for ($i = 0; $i < count($post); $i++) {
            $tags = explode(',', $post[$i]->bean['tags']);
            if(in_array($tag, $tags) ) $filtred[] = $post[$i];
        }

        $post = $filtred;

        for ($i = 0; $i < count($post); $i++) {
            $newtags = "";
            $tags = explode(',', $post[$i]->bean['tags']);
            foreach ($tags as $tag) {
                $newtags .= "<a href='/?/posts/tag/".$tag."'>".$tag."</a>, ";
            }
            $post[$i]->bean['tags'] =  substr($newtags, 0, strlen($newtags)-2);

        }
        
        $post = array_reverse($post);
        $content = ViewHandler::wrapGroup("post", $post);
        Template::reset();
        Template::assign("content",$content);
        Template::assign("allpostslink","");
        echo Template::render("main.html");
        
        
    }
开发者ID:neronmoon,项目名称:Veronica,代码行数:32,代码来源:Posts.controller.php

示例14: testSubstitutionInSubtemplate

 function testSubstitutionInSubtemplate()
 {
     $tText = 'Hello World.' . '<!-- BEGIN subtemplate -->' . " I love 'you'!" . '<!-- END subtemplate -->';
     $expText = 'Hello World.';
     $t = new Template($tText);
     $t->assign('you', 'bugs');
     $this->assertEquals($expText, $t->result());
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:8,代码来源:TemplateTest.php

示例15: render

function render($template_file, array $vars = array())
{
    $template = new Template($template_file, TEMPLATE_PATH);
    foreach ($vars as $key => $value) {
        $template->assign($key, $value);
    }
    return $template->render();
}
开发者ID:qll,项目名称:rookie-scoreboard,代码行数:8,代码来源:util.php


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