本文整理汇总了PHP中Dwoo::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Dwoo::get方法的具体用法?PHP Dwoo::get怎么用?PHP Dwoo::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dwoo
的用法示例。
在下文中一共展示了Dwoo::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($itsp)
{
$itsp->bLang->setLanguage($_GET["lang"]);
include_once "dwoo/dwooAutoload.php";
$params = array();
$params["lang"] = "dk";
$params["screen"] = "newUser";
$newUserUrl = $itsp->bUrl->newUrl("newuser", $params, 0, 0);
$params = array();
$screenshoturl = $itsp->bUrl->newUrl("screenshots", $params, 0, 0);
$params = array();
$loginUrl = $itsp->bUrl->newUrl("home", $params);
$tpl = new Dwoo_Template_File('templates/frontpage.tpl');
$dwoo = new Dwoo();
$jsfiles = array();
$jsfiles[] = array('jsfile' => 'js/newuser.js');
$markerArray = templateArray();
$markerArray["headertitle"] = $itsp->bLang->getLL("title") . " frontpage";
$markerArray["username"] = $itsp->bLang->getLL("username");
$markerArray["password"] = $itsp->bLang->getLL("password");
$markerArray["title"] = "myTasks frontpage";
$markerArray["loginbtn"] = "Login";
$markerArray["createNewUser"] = $itsp->bLang->getLL("createNewUser");
$markerArray["url"] = $newUserUrl;
$markerArray["loginUrl"] = $loginUrl;
$markerArray["js_list"] = $jsfiles;
$markerArray["screenshoturl"] = $screenshoturl;
$output = $dwoo->get($tpl, $markerArray);
print $output;
}
示例2: render
/**
* {@inheritdoc}
*/
public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
{
Profile::start('Renderer', 'Generate HTML');
$templateName = $viewName . '.' . static::$templateFileExtension;
$dwoo = new Dwoo($this->compiledPath, $this->cachePath);
$dwoo->getLoader()->addDirectory($this->functionsPath);
Profile::start('Renderer', 'Create template file.');
$template = new Dwoo_Template_File($templateName);
$template->setIncludePath($this->getTemplatesPath());
Profile::stop();
Profile::start('Renderer', 'Render');
$dwooData = new Dwoo_Data();
$dwooData->setData($model->getData());
$dwooData->assign('errorMessages', $notificationCenter->getErrors());
$dwooData->assign('successMessages', $notificationCenter->getSuccesses());
$this->setHeader('Content-type: text/html', $output);
// I do never output directly from dwoo to have the possibility to show an error page if there was a render error.
$result = $rendered = $dwoo->get($template, $dwooData, null, false);
if ($output) {
echo $result;
}
Profile::stop();
Profile::stop();
return $output ? null : $rendered;
}
示例3: main
function main($itsp)
{
include_once "dwoo/dwooAutoload.php";
$displayNewUserForm = 1;
$emailsent = "";
$reset = $itsp->bUrl->getGP("s");
$username = $itsp->bUrl->getGP("u");
$showform = 1;
$errormsg = "";
if ($_POST["reset"]) {
include_once "user_backend.php";
$user = new user_backend("reset");
if ($user->setNewPassword($_POST["reset"], $_POST["password"])) {
$showform = 0;
$tpl = new Dwoo_Template_File('templates/setnewpassword1.tpl');
$dwoo = new Dwoo();
$markerArray = templateArray();
$output = $dwoo->get($tpl, $markerArray);
print $output;
exit;
} else {
$errormsg = "Please enter a valid password";
}
}
if ($reset != "" && $username != "" && $showform) {
$tpl = new Dwoo_Template_File('templates/setnewpassword.tpl');
$dwoo = new Dwoo();
$markerArray = templateArray();
$markerArray["url"] = $_SERVER["REQUEST_URI"];
$markerArray["reset"] = $reset;
$markerArray["errormsg"] = $errormsg;
$output = $dwoo->get($tpl, $markerArray);
print $output;
}
}
示例4: renderFile
/**
* Renders a view file.
* This method is required by {@link IViewRenderer}.
* @param CBaseController the controller or widget who is rendering the view file.
* @param string the view file path
* @param mixed the data to be passed to the view
* @param boolean whether the rendering result should be returned
* @return mixed the rendering result, or null if the rendering result is not needed.
*/
public function renderFile($context, $sourceFile, $data, $return)
{
// current controller properties will be accessible as {this.property}
$data['this'] = $context;
$data['Yii'] = Yii::app();
$data["TIME"] = sprintf('%0.5f', Yii::getLogger()->getExecutionTime());
$data["MEMORY"] = round(Yii::getLogger()->getMemoryUsage() / (1024 * 1024), 2) . " MB";
// check if view file exists
if (!is_file($sourceFile) || ($file = realpath($sourceFile)) === false) {
throw new CException(Yii::t('yiiext', 'View file "{file}" does not exist.', array('{file}' => $sourceFile)));
}
//render or return
if ($return) {
return $this->dwoo->get($sourceFile, $data);
} else {
$this->dwoo->get($sourceFile, $data, null, true);
}
}
示例5: main
function main($itsp)
{
include "dwoo/dwooAutoload.php";
$tpl = new Dwoo_Template_File('templates/screenshots.tpl');
$dwoo = new Dwoo();
$markerArray = templateArray();
$markerArray["title"] = "screenshots";
$output = $dwoo->get($tpl, $markerArray);
print $output;
}
示例6: GenerateModLogRSS
function GenerateModLogRSS()
{
global $tc_db;
require_once KU_ROOTDIR . 'lib/dwoo.php';
$dwoo = new Dwoo();
$dwoo_data = new Dwoo_Data();
$entries = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "modlog` ORDER BY `timestamp` DESC LIMIT 15");
$dwoo_data->assign('entries', $entries);
$rss = $dwoo->get(KU_TEMPLATEDIR . '/rss_mod.tpl', $dwoo_data);
return $rss;
}
示例7: main
function main($itsp)
{
include "dwoo/dwooAutoload.php";
$tpl = new Dwoo_Template_File('templates/error.tpl');
$dwoo = new Dwoo();
$markerArray = templateArray();
$markerArray["title"] = $itsp->bLang->getLL("page.error.title");
$markerArray["pagenotfound"] = $itsp->bLang->getLL("page.error.pagenotfound");
$markerArray["goback"] = $itsp->bLang->getLL("page.error.goback");
$output = $dwoo->get($tpl, $markerArray);
print $output;
}
示例8: testRebuildClassPath
public function testRebuildClassPath()
{
$dwoo = new Dwoo(DWOO_COMPILE_DIR, DWOO_CACHE_DIR);
$loader = new Dwoo_Loader(TEST_DIRECTORY . '/temp/cache');
$dwoo->setLoader($loader);
$loader->addDirectory(TEST_DIRECTORY . '/resources/plugins');
file_put_contents(TEST_DIRECTORY . '/resources/plugins/loaderTest2.php', '<?php function Dwoo_Plugin_loaderTest2(Dwoo $dwoo) { return "It works!"; }');
$tpl = new Dwoo_Template_String('{loaderTest2}');
$tpl->forceCompilation();
$this->assertEquals('It works!', $dwoo->get($tpl, array(), $this->compiler));
unlink(TEST_DIRECTORY . '/resources/plugins/loaderTest2.php');
}
示例9: Dwoo_Plugin_eval
/**
* Evaluates the given string as if it was a template
*
* Although this plugin is kind of optimized and will
* not recompile your string each time, it is still not
* a good practice to use it. If you want to have templates
* stored in a database or something you should probably use
* the Dwoo_Template_String class or make another class that
* extends it
* <pre>
* * var : the string to use as a template
* * assign : if set, the output of the template will be saved in this variable instead of being output
* </pre>
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
* @link http://dwoo.org/
* @version 1.0.0
* @date 2008-10-23
* @package Dwoo
*/
function Dwoo_Plugin_eval(Dwoo $dwoo, $var, $assign = null)
{
if ($var == '') {
return;
}
$tpl = new Dwoo_Template_String($var);
$out = $dwoo->get($tpl, $dwoo->readVar('_parent'));
if ($assign !== null) {
$dwoo->assignInScope($out, $assign);
} else {
return $out;
}
}
示例10: go
function go()
{
include_once "dwoo/dwooAutoload.php";
if ($_POST) {
$tpl = new Dwoo_Template_File('templates/config.php.tpl');
$dwoo = new Dwoo();
$hostname = str_replace("http:", "", $_POST["hostname"]);
$hostname = str_replace("/", "", $hostname);
$markerArray = array();
$markerArray["dbusername"] = $_POST["mysqlusername"];
$markerArray["dbpassword"] = $_POST["mysqlpassword"];
$markerArray["dbhostname"] = $_POST["mysqlhostname"];
$markerArray["dbtable"] = $_POST["mysqldatabase"];
$markerArray["installpath"] = $_POST["installpath"];
$markerArray["basehref"] = "http://" . $hostname . "/" . $_POST["installpath"];
$markerArray["prefix"] = $_POST["mysqlprefix"];
$markerArray["prettyurls"] = $_POST["prettyurls"] ? 1 : 0;
$markerArray["hostname"] = $hostname;
$markerArray["newuseremail"] = $_POST["newuseremail"];
$markerArray["resetpasswordemail"] = $_POST["resetpassword"];
$output = "<?\n";
$output .= $dwoo->get($tpl, $markerArray);
$output .= "?>";
$fp = fopen('config.php', 'w');
fwrite($fp, $output);
fclose($fp);
include_once "config.php";
include_once "database_backend.php";
$db = new database_backend();
$db->connect();
$handle = fopen("database.sql", "rb");
$databasesql = stream_get_contents($handle);
fclose($handle);
$databasesql = str_replace("itsp_", $_POST["mysqlprefix"], $databasesql);
$sql_cmds = explode(";", $databasesql);
for ($i = 0; $i < count($sql_cmds); $i++) {
mysql_query($sql_cmds[$i]);
}
return 1;
}
$tpl = new Dwoo_Template_File('templates/wizard.tpl');
$dwoo = new Dwoo();
$markerArray = array();
$markerArray["hostname"] = "http://" . $_SERVER["HTTP_HOST"] . "/";
$markerArray["installpath"] = substr($_SERVER["REQUEST_URI"], 1);
$markerArray["newuseremail"] = "newuser@" . $_SERVER["HTTP_HOST"];
$markerArray["resetpassword"] = "resetpassword@" . $_SERVER["HTTP_HOST"];
$output = $dwoo->get($tpl, $markerArray);
print $output;
return 0;
}
示例11: main
function main($itsp)
{
include "dwoo/dwooAutoload.php";
$displayNewUserForm = 1;
$emailsent = "";
if ($_POST["username"]) {
include_once "user_backend.php";
$bUser = new user_backend("newuser");
$sess = $bUser->resetPassword($_POST["username"]);
if ($sess) {
$tpl = new Dwoo_Template_File('templates/forgotpasswordemail.tpl');
$dwoo = new Dwoo();
$params = array();
$params["s"] = $sess["reset"];
$params["u"] = $sess["username"];
$setnewpasswordUrl = $itsp->bUrl->newUrl("setnewpassword", $params, 1);
$markerArray = array();
$markerArray["emailForgotpasswordHello"] = $itsp->bLang->getLL("email.forgotpassword.hello");
$markerArray["username"] = $sess["username"];
$markerArray["emailForgotpasswordHostname"] = config::hostname;
$markerArray["emailForgotpasswordMsg1"] = $itsp->bLang->getLL("email.forgotpassword.msg1");
$markerArray["emailForgotpasswordMsg2"] = $itsp->bLang->getLL("email.forgotpassword.msg2");
$markerArray["emailForgotpasswordMsg3"] = $itsp->bLang->getLL("email.forgotpassword.msg3");
$markerArray["emailForgotpasswordMsg4"] = $itsp->bLang->getLL("email.forgotpassword.msg4");
$markerArray["emailForgotpasswordMsg5"] = $itsp->bLang->getLL("email.forgotpassword.msg5");
$markerArray["emailForgotpasswordMsg6"] = $itsp->bLang->getLL("email.forgotpassword.msg6");
$markerArray["emailForgotpasswordURL"] = $setnewpasswordUrl;
$markerArray["emailForgotpasswordSignature"] = $itsp->bLang->getLL("email.forgotpassword.signature");
$forgotemail = $dwoo->get($tpl, $markerArray);
$emailto = $sess["email"];
$emailsubject = $itsp->bLang->getLL("email.forgotpassword.subject");
$emailheaders = "From: " . config::resetpasswordFromEmail . "\r\n";
mail($emailto, $emailsubject, $forgotemail, $emailheaders);
$emailsent = "Email sent";
}
}
if ($displayNewUserForm) {
$tpl = new Dwoo_Template_File('templates/forgotpassword.tpl');
$dwoo = new Dwoo();
$markerArray = templateArray();
$markerArray["url"] = $_SERVER["REQUEST_URI"];
$markerArray["username"] = $itsp->bLang->getLL("username");
$markerArray["password"] = $itsp->bLang->getLL("password");
$markerArray["headertitle"] = $itsp->bLang->getLL("page.forgotpassword.title");
$markerArray["loginbtn"] = $itsp->bLang->getLL("login");
$markerArray["sendit"] = $itsp->bLang->getLL("sendit");
$markerArray["emailsent"] = $emailsent;
$createnewuser = $dwoo->get($tpl, $markerArray);
print $createnewuser;
}
}
示例12: notify
/**
* @param $eventData
* @return void
*/
public function notify()
{
$iso = $this->_getLocale();
$message = $this->_emailNotification->{$iso};
if ($message == null) {
return;
}
$dwoo = new Dwoo();
$template = new Dwoo_Template_String($message);
$data = new Dwoo_Data();
$data = $this->_assign($data);
$parsedMessage = $dwoo->get($template, $data);
return $this->_send($parsedMessage);
}
示例13: main
function main($itsp)
{
$itsp->bLang->setLanguage($_GET["lang"]);
include "dwoo/dwooAutoload.php";
$tpl = new Dwoo_Template_File('templates/login.tpl');
$dwoo = new Dwoo();
$markerArray = array();
$markerArray["headertitle"] = $itsp->bLang->getLL("title");
$markerArray["username"] = $itsp->bLang->getLL("username");
$markerArray["password"] = $itsp->bLang->getLL("password");
$markerArray["loginbtn"] = "Login";
$settings = $dwoo->get($tpl, $markerArray);
print $settings;
}
示例14: main
function main($itsp)
{
include "dwoo/dwooAutoload.php";
if ($itsp->bUrl->getGP("s")) {
user_backend::verifyUser($itsp->bUrl->getGP("s"), $itsp->bUrl->getGP("u"), 9);
$tpl = new Dwoo_Template_File('templates/rejectuser.tpl');
$dwoo = new Dwoo();
$markerArray = templateArray();
$markerArray["pageRejectedMsg1"] = $itsp->bLang->getLL("page.rejecteduser.msg1");
$output = $dwoo->get($tpl, $markerArray);
print $output;
} else {
print "access denied";
}
}
示例15: Dwoo_Plugin_include
/**
* Inserts another template into the current one
* <pre>
* * file : the resource name of the template
* * cache_time : cache length in seconds
* * cache_id : cache identifier for the included template
* * compile_id : compilation identifier for the included template
* * data : data to feed into the included template, it can be any array and will default to $_root (the current data)
* * assign : if set, the output of the included template will be saved in this variable instead of being output
* * rest : any additional parameter/value provided will be added to the data array
* </pre>
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
* @link http://dwoo.org/
* @version 1.1.0
* @date 2009-07-18
* @package Dwoo
*/
function Dwoo_Plugin_include(Dwoo $dwoo, $file, $cache_time = null, $cache_id = null, $compile_id = null, $data = '_root', $assign = null, array $rest = array())
{
if ($file === '') {
return;
}
if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
// resource:identifier given, extract them
$resource = $m[1];
$identifier = $m[2];
} else {
// get the current template's resource
$resource = $dwoo->getTemplate()->getResourceName();
$identifier = $file;
}
try {
if (!is_numeric($cache_time)) {
$cache_time = null;
}
$include = $dwoo->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
} catch (Dwoo_Security_Exception $e) {
return $dwoo->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
} catch (Dwoo_Exception $e) {
return $dwoo->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
}
if ($include === null) {
return $dwoo->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.', E_USER_WARNING);
} elseif ($include === false) {
return $dwoo->triggerError('Include : Resource "' . $resource . '" does not support includes.', E_USER_WARNING);
}
if ($dwoo->isArray($data)) {
$vars = $data;
} elseif ($dwoo->isArray($cache_time)) {
$vars = $cache_time;
} else {
$vars = $dwoo->readVar($data);
}
if (count($rest)) {
$vars = $rest + $vars;
}
$out = $dwoo->get($include, $vars);
if ($assign !== null) {
$dwoo->assignInScope($out, $assign);
} else {
return $out;
}
}