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


PHP Template::replace方法代码示例

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


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

示例1: testTemplateClass

function testTemplateClass()
{
    $t = new Template('index.html');
    $t->replace('FOOTER', '<b>This is the footer</b>');
    $t->replace('LOGIN_FORM', joinPaths(CHRIS_VIEW_FOLDER, 'login_form.html'));
    return $t;
}
开发者ID:masroore,项目名称:chrisreloaded,代码行数:7,代码来源:test.template.class.php

示例2: getHTML

 public static function getHTML($object)
 {
     $t = new Template('plugin.html');
     $t->replace('PLUGIN_CAROUSEL', PluginV::getCarousel($object));
     $plugin_parameters = '';
     foreach ($object as $p) {
         $plugin_parameters .= PluginC::getUI($p['name']);
     }
     $t->replace('PLUGIN_PARAMETERS', $plugin_parameters);
     return $t;
 }
开发者ID:masroore,项目名称:chrisreloaded,代码行数:11,代码来源:plugin.view.php

示例3: testTemplateType

 private static function testTemplateType()
 {
     if (self::$clanData['data']['premiumBis'] < time()) {
         if (!empty(self::$clanData['data']['useStandartDesign'])) {
             echo "Eigenes Standart Design ";
         } else {
             Template::init("templates/standart.html");
             Template::replace("</head>", "\n" . Template::leerzeichen("<title>") . '<link rel="stylesheet" type="text/css" href="http://myclankonto.net/' . self::$routerData['clanid'] . '/stylecheet.css" />' . "\n" . Template::leerzeichen("<head>") . '</head>');
             Template::replaceContent("{seiteninhalt}", "pages/site/" . self::$routerData['site'] . ".php");
             Template::replace("{title}", self::$clanData['data']['pageTitle']);
             echo Template::out();
         }
     } else {
         MySQL::query("SELECT * FROM `inhalte` WHERE `clanid`='" . self::$routerData['clanid'] . "' AND `template`='1' AND `templateType`='5'");
         if (MySQL::count() == 1) {
             $row = MySQL::fetchArray();
             Template::init(NULL, true, $row['inhalt']);
             MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='6'");
             if (MySQL::count()) {
                 Template::replace("</head>", "\n" . Template::leerzeichen("<title>") . '<link rel="stylesheet" type="text/css" href="http://myclankonto.net/' . self::$routerData['clanid'] . '/stylecheet.css" />' . "\n" . Template::leerzeichen("<head>") . '</head>');
             }
             Template::replaceContent("{seiteninhalt}", "pages/site/" . self::$routerData['site'] . ".php");
             Template::replace("{title}", self::$clanData['data']['pageTitle']);
             echo Template::out();
         } else {
             echo "Premium Standart";
         }
     }
 }
开发者ID:homieforever,项目名称:MyClanKonto,代码行数:29,代码来源:site.php

示例4: testTemplateType

 private static function testTemplateType()
 {
     if (self::$clanData['premiumBis'] < time()) {
         if (!empty(self::$clanData['useStandartDesign'])) {
             echo "Eigenes Standart Design ";
         } else {
             Template::init("templates/standart_stylecheet.css");
             Template::replace("{header_height}", self::$clanData['designset_headerheight']);
             Template::set("Content-Type: text/css");
             echo Template::out();
         }
     } else {
         MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='5'");
         if (MySQL::count()) {
             MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='6'");
             if (MySQL::count()) {
                 $row = MySQL::fetchArray();
                 Template::init(NULL, true, $row['inhalt']);
                 Template::replace("{header_height}", self::$clanData['designset_headerheight']);
                 Template::set("Content-Type: text/css");
                 echo Template::out();
             }
         } else {
             echo "Premium Standart";
         }
     }
 }
开发者ID:homieforever,项目名称:MyClanKonto,代码行数:27,代码来源:stylecheet.php

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

示例6: readView

 private static function readView()
 {
     $plantilla = new Template();
     $bd = new BaseDatos();
     $gestor = new ManageArtist($bd);
     $gestorUsuario = new ManageUser($bd);
     $gestorimagenes = new ManageGallery($bd);
     //Carga de plantillas
     $vista = $plantilla->getContents("../_plantilla1/_index.html");
     $nav = $plantilla->getContents("../_plantilla1/_nav.html");
     $login = $plantilla->getContents("../_plantilla1/_login.html");
     $gallery = $plantilla->getContents("../_plantilla1/_gallery.html");
     $artistas_plantilla = $plantilla->getContents("../_plantilla1/_artistas.html");
     $lista_artistas = $plantilla->getContents("../_plantilla1/_lista-artistas.html");
     //Todos los Artistas ------------------------------
     $usuarios = $gestorUsuario->getList();
     $imagenes = $gestorimagenes->getList();
     $elementos = "";
     $elementos_a = "";
     foreach ($usuarios as $key => $artista) {
         if ($artista->getActivo() == 1 || $artista->getPersonal() == 1 || $artista->getAdministrador() == 1) {
             $elemento_i = $plantilla->replace("nombre_artista", $artista->getAlias(), $lista_artistas);
             $elemento_i = $plantilla->replace("mail_artista", $artista->getEmail(), $elemento_i);
             $elementos_a .= $elemento_i;
         }
     }
     if (Request::req("email") == "") {
         $elementos = self::loadImage($plantilla, $gallery, $imagenes, $elementos);
     } else {
         $email = Request::req("email");
         $email_artista = $gestorUsuario->get($email)->getEmail();
         $art_album = $gestor->get($email_artista)->getGaleria();
         $galeria_personalizada = $gestorimagenes->getList();
         foreach ($galeria_personalizada as $key => $imagen) {
             if ($imagen->getId() == $art_album) {
                 $elemento = $plantilla->replace("src", $imagen->getImagen(), $gallery);
                 $elemento = $plantilla->replace("piefoto", $imagen->getDescripcion(), $elemento);
                 $elemento = $plantilla->replace("id_imagen", $imagen->getId_imagen(), $elemento);
                 $elemento = $plantilla->replace("album", $imagen->getId(), $elemento);
                 $elementos .= $elemento;
             }
         }
     }
     $artistas_plantilla = $plantilla->replace("lista_artistas", $elementos_a, $artistas_plantilla);
     $datos = array("nav" => $nav, "work" => "", "edit" => "", "titulo" => "Galeria de Arte", "formulario" => "", "mensajes" => "", "descripcion" => 'Arte por todas partes', "login" => $login, "profile" => "", "upload" => "", "artistas" => $artistas_plantilla, "gallery" => "{$elementos}", "contact" => "");
     echo $plantilla->insertTemplate($vista, $datos);
 }
开发者ID:ealvarez1990,项目名称:galeriaarte,代码行数:47,代码来源:ControladorFrontEnd.php

示例7: runTest

 private function runTest($metadata, Template $template, $memcheck = false)
 {
     $test_args = $template->hasArgs();
     foreach ($this->args as $key => $arg) {
         // Prepare for next template
         $template->clear();
         $template->replace('funcname', @$metadata['function']);
         $template->replace('classname', @$metadata['class']);
         $template->replace('methodname', @$metadata['method']);
         // For argument concatenation
         $template->replace('args2', empty($arg) ? $arg : $arg . ',');
         // For argument without concatenation
         $template->replace('args', $arg);
         if ($test_args) {
             printf("- %s - Args: %s\n", $metadata['name'], $arg);
         } else {
             printf("- %s:\n", $metadata['name']);
         }
         if ($memcheck) {
             $ret = $this->memcheck($metadata['name'], $template->getSource());
         } else {
             $ret = $this->execute($metadata['name'], $template->getSource());
             switch ($ret) {
                 case 139:
                     /* signal 11 */
                     printf(" SIGSEGV\n", $ret);
                     break;
                 default:
                     printf(" Exit status = %d\n", $ret);
                     break;
             }
             if (!$test_args) {
                 break;
             }
         }
     }
 }
开发者ID:shaikhlut,项目名称:fuzzing,代码行数:37,代码来源:template.fuzzer.php

示例8: notifyModerators

function notifyModerators($id, $page, $text, $userName, $name, $product, $moderators)
{
    $template = new Template("./templates/newCommentToModerate.html");
    $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $product;
    $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentToModerate');
    if (defined('__MODERATE__') && !__MODERATE__) {
        $template = new Template("./templates/newUnmoderatedComment.html");
        $subject = "[" . $productTranslate . "] " . Utils::translate('newUnmoderatedCommentAdded');
    }
    $subject .= " [" . $page . "]";
    $ca = base64_encode($id . "&approved");
    $cr = base64_encode($id . "&deleted");
    $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $page . "#" . $id, "text" => $text, "userName" => $userName, "user" => $name, "productName" => $productTranslate, "aproveLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $ca, "deleteLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $cr));
    foreach ($moderators as $key => $value) {
        $mail = new Mail();
        $mail->Subject($subject);
        $mail->To($value);
        $mail->From(__EMAIL__);
        $mail->Body($confirmationMsg);
        $mail->Send();
    }
}
开发者ID:aidanreilly,项目名称:documentation,代码行数:22,代码来源:comment.php

示例9: ThreadList

    // Det ?r vi, fixa variabler
    $iNumberThreads = $_SESSION['oUser']->getNumberThreads();
    $iThreadTimestamp = $_SESSION['oUser']->getLastLogout();
    $a_iOldThreads = $_SESSION['a_iOldThreads'];
}
// H?mta tr?dlistan
$oTL = new ThreadList();
if (FALSE === ($a_oThreads = $oTL->getThreads($_GET['Sort'], $iNumberThreads, $iNumberThreads * ($_GET['Page'] - 1), $iThreadTimestamp, $a_iOldThreads))) {
    trigger_error("11: " . $oTL->getErrorMsg(), E_USER_WARNING);
}
// Bygg upp sidan
$oTemplate->set("title", $oConfiguration->getCustomValue("Title"));
if ($bInlogged) {
    $oTemplate->set("User_ID", $_SESSION['oUser']->getID());
    $oTemplate->set("User_Name", htmlspecialchars($_SESSION['oUser']->getName()));
    $oTemplate->replace("Login_Outside", "Login_Inside");
}
$oTemplate->set("Page", $_GET['Page']);
$oTemplate->set("Page_Next", $_GET['Page'] + 1);
$oTemplate->set("Page_Prev", $_GET['Page'] - 1);
$oTemplate->set("Sort", $_GET['Sort']);
$iCounter = 0;
foreach (array_keys($a_oThreads) as $iThread) {
    $oThread =& $a_oThreads[$iThread];
    $oUser = $oThread->getUser();
    $oLastUser = $oThread->getLastPostUser();
    $oTemplate->set("Thread_ID", $oThread->getThreadID());
    $oTemplate->set("Thread_Rubrik", $oThread->getRubrik());
    $oTemplate->set("Thread_Answers", $oThread->getNumberPosts() - 1);
    $oTemplate->set("Thread_Reads", $oThread->getNumberReads());
    $oTemplate->set("Thread_Last_Time", fixDateFormat($oThread->getLastPostTimestamp()));
开发者ID:eliego,项目名称:daft,代码行数:31,代码来源:ThreadList.php

示例10: elseif

            }
        }
    }
}
/* validate page request */
// empty defaults to landing page set in config
if (empty($_REQUEST['page'])) {
    $loadPage = $cfg['landing_page'];
} elseif (in_array($_REQUEST['page'], $pagesArray)) {
    $loadPage = $_REQUEST['page'];
} else {
    die('page: ' . $_REQUEST['page'] . ', does not exist');
}
// else $loadPage='404error';
/* output page */
$template->load(PATH . './pages/' . $loadPage . '.php');
$templateList = loadTemplates();
foreach ($templateList as $tpl) {
    $tplName = substr($tpl, 0, strlen($tpl) - 4);
    $template->replace($tplName, file_get_contents(PATH . $cfg['theme_templateDir'] . $tpl));
}
$template->publish();
/* debug stats */
@(print '<p>' . mysql_stat($cfg['mysql_linkid']) . '</p>');
$microTime = microtime();
$microTime = explode(' ', $microTime);
$microTime = $microTime[1] + $microTime[0];
$loadEnd = $microTime;
$loadTime = round($loadEnd - $loadStart, 4);
echo '<p>Page generated in ' . $loadTime . ' seconds.' . '</p>';
exit;
开发者ID:nef-cms,项目名称:nef-cms,代码行数:31,代码来源:index.php

示例11: send_password

 /**
  * Sends the newly generated password to the email of user using the given username in the model.
  * @return boolean whether successfuly send password
  */
 public function send_password($user_id)
 {
     $userModel = new SuUser();
     $model = new Admin_ajax();
     $password = $userModel->random_password();
     $this->user_password = md5($password);
     $userData = $this->getUserData($user_id);
     $userData['user_password'] = $password;
     ///////////////////////////////////////////////////////////////////////
     ///////////Create Forgot password email Template //////////////////////
     ///////////////////////////////////////////////////////////////////////
     $tempemaildata = $model->customOneRowQuery("SELECT * FROM `su_notification_templates`  WHERE type='email' and alias='forgotpassward'");
     $emailtemplate = new Template();
     $emailtemplate->setKeys($userData);
     $emailText = $emailtemplate->replace($tempemaildata['content']);
     ///////////////////////////////////////////////////////////////////////
     ///////////End Create Forgot password email Template //////////////////
     ///////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////
     ///////////Create Forgot password email Template //////////////////////
     ///////////////////////////////////////////////////////////////////////
     $tempsmsdata = $model->customOneRowQuery("SELECT * FROM `su_notification_templates`  WHERE type='sms' and alias='forgotpassward'");
     $smstemplate = new Template();
     $smstemplate->setKeys($userData);
     $smsText = $smstemplate->replace($tempsmsdata['content']);
     //print_r($userData);die;
     ///////////////////////////////////////////////////////////////////////
     ///////////End Create Forgot password email Template //////////////////
     ///////////////////////////////////////////////////////////////////////
     //        $data = array("name" => $userData["user_fname"], "email" => $userData["user_email"], "password" => $password);
     //        $msg_data = 'Below are the new password for PayWayhelp account :
     //
     //                   Username/Email : ' . $userData["user_email"] . '
     //
     //                   Password :  ' . $password;
     $insert = $this->set_password($this->user_password, $user_id);
     $admin_ajax = new Admin_ajax();
     $msg_id = '';
     // if ($insert) {
     if (isset($userData["user_notification"]) && $userData["user_notification"] == 'both') {
         //$UserEmail = new UserEmail($this->username,$this->user_password);
         $UserEmail = new UserEmail();
         //$status = $UserEmail->SendMail($userData["user_email"], 'Reset Password', 'reset_password', $data);
         $UserEmail->SendCustomMail($userData["user_email"], "Paywayhelp : Reset Password", $emailText);
         //sms api
         //$msg_id = $this->send_sms_via_gateway($userData["user_fname"], 'Reset Password', $msg_data);
         $msg_id = $this->send_sms_via_gateway($userData["user_phoneNumber"], 'Reset Password', $smsText);
         //add message data
         $admin_ajax->insert_data('su_message', array('message_id' => $msg_id, 'message_user' => $user_id, 'message_date' => date('Y-m-d H:i:s')));
     } elseif (isset($userData["user_notification"]) && $userData["user_notification"] == 'mail') {
         $UserEmail = new UserEmail();
         //$status = $UserEmail->SendMail($userData["user_email"], 'Reset Password', 'reset_password', $data);
         $UserEmail->SendCustomMail($userData["user_email"], "Paywayhelp : Reset Password", $emailText);
     } elseif (isset($userData["user_notification"]) && $userData["user_notification"] == 'sms') {
         //sms api
         $msg_id = $this->send_sms_via_gateway($userData["user_phoneNumber"], 'Reset Password', $smsText);
         //add message data
         $admin_ajax->insert_data('su_message', array('message_id' => $msg_id, 'message_user' => $user_id, 'message_date' => date('Y-m-d H:i:s')));
     }
     return $msg_id;
     /*  } else {
         return false;
         } */
 }
开发者ID:bhaiyyalal,项目名称:testcode,代码行数:68,代码来源:ForgetPassword.php

示例12: Mail

            $mail = new Mail();
            $mail->Subject("[" . $productTranslate . "] " . Utils::translate('RecoveredEmailSubject'));
            $mail->To($info['email']);
            $mail->From(__EMAIL__);
            $mail->Body($confirmationMsg);
            $mail->Send();
            $user->changePassword($info['email'], $generateInfo['generated']);
            $toReturn->set("success", "true");
            $toReturn->set("message", Utils::translate('passwordChanged'));
        } else {
            // confirmation link
            $data = date('Y-m-d H:i:s');
            $template = new Template("./templates/" . __LANGUAGE__ . "/confirmRecover.html");
            $id = base64_encode($info['email'] . "|" . $data . "|recover|" . $generateInfo['generated']);
            $link = "<a href='" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}'>" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}</a>";
            $confirmationMsg = $template->replace(array("product" => $info['product'], "link" => $link, "productName" => $productTranslate));
            $mail = new Mail();
            $mail->Subject("[" . $productTranslate . "] " . Utils::translate('RecoverConfirmationEmailSubject'));
            $mail->To($info['email']);
            $mail->From(__EMAIL__);
            $mail->Body($confirmationMsg);
            $mail->Send();
            $toReturn->set("success", "true");
            $toReturn->set("message", Utils::translate('confirmationRequired'));
        }
    }
    //echo "Success";
} else {
    $toReturn->set("success", "false");
    $toReturn->set("message", Utils::translate('noEmailSpecified'));
    //echo "Invalid recovery data!";
开发者ID:bdensmore,项目名称:dita-docs,代码行数:31,代码来源:recover.php

示例13: array

<?php

chdir('..');
require 'libraries/start.php';
// setup
$message = '';
$config = array();
// save input
if (array_key_exists('config', $_POST) && $_POST['config']) {
    $config = Http::clean($_POST['config'], 'html');
    $errors = find_configuration_errors($config);
    // display errors, if any
    if ($errors) {
        foreach ($errors as $error) {
            $message .= "<p class='error'>{$error}</p>";
        }
    } else {
        Configuration::write($config);
        Configuration::reset();
    }
}
// get config
$config = Configuration::getInstance();
// templating
$t = new Template(Configuration::get('base_dir') . DS . 'templates' . DS . 'base.html');
$t->replace('base_url', Configuration::get('base_url'));
$t->replaceFromPHPFile('content', Configuration::get('base_dir') . DS . 'templates' . DS . 'configuration.html', array('c' => $config));
$t->replace('message', $message);
$t->display();
开发者ID:amad4biz,项目名称:invoices,代码行数:29,代码来源:configure.php

示例14: htmlspecialchars

}
if ($bInlogged) {
    $_SESSION['a_iOldThreads'][$_GET['ID']] = $oThread->getNumberPosts();
}
// Markera tr?den som l?st
$oThread->read();
if (FALSE === ($a_oPosts = $oThread->getPosts($iNumberPosts * ($_GET['Page'] - 1), $iNumberPosts))) {
    trigger_error("23. " . $oThread->getErrorMsg(), E_USER_WARNING);
}
// Bygg upp sidan
$oTemplate->set("title", $oConfiguration->getCustomValue("Title"));
$oTemplate->set("id", $oThread->getThreadID());
if ($bInlogged) {
    $oTemplate->set("User_ID", $_SESSION['oUser']->getID());
    $oTemplate->set("User_Name", htmlspecialchars($_SESSION['oUser']->getName()));
    $oTemplate->replace("Login_Outside", "Login_Inside");
    $oTemplate->replace("CantPost", "NewPost");
}
// Kolla om det finns fler sidor
if ($oThread->getNumberPosts() > $iNumberPosts) {
    $oTemplate->replace("Empty", "MultiPages");
    $oTemplate->replace("Empty2", "MultiPages");
    $iPages = (int) (@$oThread->getNumberPosts() / $iNumberPosts);
    if (!((double) $iPages == @$oThread->getNumberPosts() / $iNumberPosts)) {
        $iPages++;
    }
    for ($n = 1; $n <= $iPages; $n++) {
        $oTemplate->set("Page", $n);
        $oTemplate->parse("MultiPage");
        $oTemplate->parse("MultiPage2");
    }
开发者ID:eliego,项目名称:daft,代码行数:31,代码来源:ShowThread.php

示例15: deleteToHtml

 protected function deleteToHtml($deleted)
 {
     // get template
     $template = new Template(Configuration::get('base_dir') . DS . 'templates' . DS . 'base.html');
     $template->replace('base_url', Configuration::get('base_url'));
     // make title
     $title = 'Invoice Deleted Successfully';
     $template->replace('title', $title);
     // make body
     $body = '<a href="' . $this->getLink() . '">List All</a> ';
     $body .= $deleted ? '<p>Deleted successfully.</p>' : '<p>Failed to delete.</p>';
     $template->replace('content', $body);
     // return
     return $template;
 }
开发者ID:amad4biz,项目名称:invoices,代码行数:15,代码来源:InvoiceHtml.php


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