本文整理汇总了PHP中tmpl_iterate函数的典型用法代码示例。如果您正苦于以下问题:PHP tmpl_iterate函数的具体用法?PHP tmpl_iterate怎么用?PHP tmpl_iterate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tmpl_iterate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
function getList()
{
global $db_game, $params;
$template = tmpl_open("modules/Module_Artefacts/templates/list.ihtml");
$artefacts = artefact_lib_get_artefacts();
//tmpl_set($template, 'ARTEFACT', $artefacts);
foreach ($artefacts as $artefact) {
// in cave
if ($artefact['caveID'] && !$artefact['event_movementID']) {
tmpl_iterate($template, '/ARTEFACTINCAVE');
tmpl_set($template, '/ARTEFACTINCAVE', $artefact);
} else {
if ($artefact['event_movementID']) {
tmpl_iterate($template, '/ARTEFACTMOVING');
tmpl_set($template, '/ARTEFACTMOVING', $artefact);
} else {
tmpl_iterate($template, '/ARTEFACTLIMBO');
tmpl_set($template, '/ARTEFACTLIMBO', $artefact);
}
}
}
// show messages
if (sizeof($this->msgs)) {
foreach ($this->msgs as $msg) {
tmpl_iterate($template, "/MESSAGE");
tmpl_set($template, "/MESSAGE/message", $msg);
}
}
return tmpl_parse($template);
}
示例2: tribePlayerList_getContent
function tribePlayerList_getContent($caveID, $tribe)
{
global $db, $no_resource_flag, $config, $params;
$no_resource_flag = 1;
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribePlayerList.ihtml');
tmpl_set($template, 'tribe', $tribe);
$query = 'SELECT r.rank, r.playerID AS link, r.name, r.average AS points, r.caves, r.religion, r.fame, p.awards ' . ' FROM Ranking r' . ' LEFT JOIN Player p' . ' ON p.playerID = r.playerID' . ' WHERE p.tribe LIKE "' . $tribe . '"' . ' ORDER BY r.rank ASC';
if (!($dbresult = $db->query($query))) {
page_dberror();
}
while ($row = $dbresult->nextRow(MYSQL_ASSOC)) {
$i++;
tmpl_iterate($template, 'ROWS');
$row['link'] = "main.php?modus=" . PLAYER_DETAIL . "&detailID=" . $row['link'] . "&caveID=" . $caveID;
if (!empty($row['awards'])) {
$tmp = explode('|', $row['awards']);
$awards = array();
foreach ($tmp as $tag) {
$awards[] = array('tag' => $tag, 'award_modus' => AWARD_DETAIL);
}
$row['award'] = $awards;
}
if ($i % 2) {
tmpl_set($template, 'ROWS/ROW_ALTERNATE', $row);
} else {
tmpl_set($template, 'ROWS/ROW', $row);
}
}
return tmpl_parse($template);
}
示例3: questionnaire_getQuestionnaire
function questionnaire_getQuestionnaire($caveID, &$meineHoehlen)
{
global $config, $params, $no_resource_flag;
$no_resource_flag = 1;
$msg = "";
if (isset($params->POST->question)) {
$msg = questionnaire_giveAnswers();
}
$template = tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/questionnaire.ihtml');
// show message
if ($msg != "") {
tmpl_set($template, 'MESSAGE/message', $msg);
}
// show my credits
if ($account = questionnaire_getCredits($params->SESSION->user['questionCredits'])) {
tmpl_set($template, 'ACCOUNT', $account);
}
// show the questions
$questions = questionnaire_getQuestions();
if (sizeof($questions)) {
tmpl_set($template, 'QUESTIONS/QUESTION', $questions);
// set params
tmpl_set($template, 'QUESTIONS/PARAMS', array(array('name' => "modus", 'value' => QUESTIONNAIRE)));
} else {
tmpl_iterate($template, 'MESSAGE');
tmpl_set($template, 'MESSAGE/message', "Derzeit liegen keine weiteren Fragen vor.");
}
// show the link to the present page
tmpl_set($template, 'QUESTIONNAIRE_PRESENTS', QUESTIONNAIRE_PRESENTS);
return tmpl_parse($template);
}
示例4: award_getAwardDetail
/** This function returns basic award details
*
* @param tag the current award's tag
*/
function award_getAwardDetail($tag)
{
// get configuration settings
global $config;
// get parameters from the page request
global $params;
// get db link
global $db;
$msgs = array();
$sql = "SELECT * FROM Awards WHERE tag = '{$tag}'";
$result = $db->query($sql);
if (!$result || $result->isEmpty()) {
$msgs[] = sprintf(_('Dieser Orden existiert nicht: "%s".'), $tag);
$row = array();
} else {
$row = $result->nextRow(MYSQL_ASSOC);
}
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'award_detail.ihtml');
if (sizeof($msgs)) {
foreach ($msgs as $msg) {
tmpl_iterate($template, "MESSAGE");
tmpl_set($template, "MESSAGE/message", $msg);
}
}
if (sizeof($row)) {
tmpl_set($template, 'AWARD', $row);
}
return tmpl_parse($template);
}
示例5: improvement_deleteConfirm
function improvement_deleteConfirm($caveID, $buildingID)
{
global $config, $db, $no_resource_flag, $buildingTypeList, $params;
$no_resource_flag = 1;
// Show confirmation request
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'dialog.ihtml');
tmpl_set($template, 'message', sprintf(_('Möchten Sie 1 %s abreissen?'), $buildingTypeList[$buildingID]->name));
tmpl_set($template, 'BUTTON/formname', 'confirm');
tmpl_set($template, 'BUTTON/text', _('Abreißen'));
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', IMPROVEMENT_DETAIL);
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'breakDownConfirm');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
tmpl_iterate($template, 'BUTTON/ARGUMENT');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'buildingID');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $buildingID);
tmpl_iterate($template, 'BUTTON/ARGUMENT');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveID');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
tmpl_iterate($template, 'BUTTON');
tmpl_set($template, 'BUTTON/formname', 'cancel');
tmpl_set($template, 'BUTTON/text', _('Abbrechen'));
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', IMPROVEMENT_DETAIL);
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveID');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
return tmpl_parse($template);
}
示例6: show_adressbook
function show_adressbook($playerID, $deleteID)
{
global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $unitTypeList, $config, $params, $db;
// messages
$messageText = array(0 => "Spieler wurde eingetragen.", 1 => "Es gibt keinen Spieler mit diesem Namen.", 2 => "Dieser Spieler ist schon in der Liste.", 3 => "Spieler aus der Liste gelöscht.", 4 => "Spieler konnte nicht aus der Liste entfernt werden.", 5 => "Verarsch mich nicht!", 6 => "Datenbank Fehler.");
// enter something new
if (isset($params->POST->empfaenger)) {
$messageID = book_newEntry($playerID, $params->POST->empfaenger);
}
if (isset($params->POST->newEntryName)) {
$messageID = book_newEntry($playerID, $params->POST->newEntryName);
} else {
if ($deleteID > 0) {
$messageID = book_deleteEntry($playerID, $deleteID);
}
}
$template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/message_book.ihtml");
// Show a special message
if (isset($messageID)) {
tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
}
// Getting entries
// call our function
$playerlist = book_getEntries($playerID);
// Show the player table
for ($i = 0; $i < sizeof($playerlist[id]); $i++) {
$playername = $playerlist[name][$i];
// the current playername
$tribe = $playerlist[tribe][$i];
// the current tribe
$tribelink = "<a href=\"main.php?modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($tribe)) . "\" target=\"_blank\">";
if ($tribe != "") {
$tribe = "(" . $tribe . ")";
}
$playerID = $playerlist[id][$i];
$link = "<a href=\"main.php?modus=" . NEW_MESSAGE . "&playerID=" . $playername . "\">";
tmpl_iterate($template, '/PLAYER');
tmpl_set($template, "PLAYER/alternate", $count++ % 2 ? "alternate" : "");
if ($playername != "Spieler nicht auffindbar") {
tmpl_set($template, "PLAYER/LINK/link", $link);
}
tmpl_set($template, 'PLAYER', array('name' => $playername, 'tribe' => $tribe, 'tribelink' => $tribelink, 'playerID' => $playerID, 'modus' => NEW_MESSAGE, 'modus_delete' => MESSAGE_BOOK_DELETE));
}
if (sizeof($playerlist) < 1) {
tmpl_set($template, "NOPLAYER/dummy", "");
}
return tmpl_parse($template);
}
示例7: tribeHistory_getContent
function tribeHistory_getContent($tag)
{
global $no_resource_flag, $config, $params, $db;
$no_resource_flag = 1;
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribeHistory.ihtml');
$history = relation_getTribeHistory($tag, $db);
foreach ($history as $key => $values) {
tmpl_iterate($template, 'ROWS');
if ($i++ % 2) {
tmpl_set($template, 'ROWS/ROW_ALTERNATE', $values);
} else {
tmpl_set($template, 'ROWS/ROW', $values);
}
}
return tmpl_parse($template);
}
示例8: _list
function _list($feedback = NULL)
{
global $db_game, $params;
$this->_getDetails('all');
if (empty($this->item)) {
$feedback = 'Keine Einträge vorhanden.';
}
$template = tmpl_open("modules/Module_DoYouKnow/templates/list.ihtml");
foreach ($this->item as $item) {
tmpl_iterate($template, '/DOYOUKNOW');
tmpl_set($template, '/DOYOUKNOW', $item);
}
if ($feedback) {
tmpl_set($template, '/MESSAGE/message', $feedback);
}
return tmpl_parse($template);
}
示例9: doYouKnow_getContent
function doYouKnow_getContent()
{
global $db, $config;
$template = tmpl_open($_SESSION['player']->getTemplatePath() . 'doYouKnow.ihtml');
if (request_var('show', "") == "all") {
$sql = $db->prepare("SELECT * FROM " . DO_YOU_KNOW_TABLE);
} else {
$sql = $db->prepare("SELECT * FROM " . DO_YOU_KNOW_TABLE . " ORDER BY RAND( ) LIMIT 0 , 1");
}
$sql->execute();
while ($row = $sql->fetch(PDO::FETCH_ASSOC)) {
tmpl_iterate($template, "ELEM");
tmpl_set($template, array("ELEM/header" => $row['titel'], "ELEM/text" => str_replace("\n", "<br />", $row['content'])));
}
if (request_var('show', "") != "all") {
tmpl_iterate($template, "LINKLIST");
}
return tmpl_parse($template);
}
示例10: ticker_getMessages
function ticker_getMessages($playerID)
{
// hm need to check this
global $buildingTypeList, $defenseSystemTypeList, $resourceTypeList, $scienceTypeList, $unitTypeList, $wonderTypeList, $effectTypeList, $terrainList, $config, $params, $db;
// open the template
$template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/ticker_archive.ihtml');
// Getting the messages
$messages = getTickerMessages($db);
// Templating
$data = array();
if (!sizeof($messages)) {
$data['NOMESSAGES'] = array('dummy' => "");
} else {
$data['MESSAGES'] = $messages;
tmpl_iterate($template, 'MESSAGES');
}
tmpl_set($template, "/", $data);
return tmpl_parse($template);
}
示例11: doYouKnow_getContent
function doYouKnow_getContent()
{
global $config;
global $params;
global $db;
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'doYouKnow.ihtml');
if ($params->POST->show == "all") {
$query = "SELECT * FROM `doYouKnow`";
} else {
$query = "SELECT * FROM `doYouKnow` ORDER BY RAND( ) LIMIT 0 , 1";
}
$result = $db->query($query);
while ($row = $result->nextRow(MYSQL_ASSOC)) {
tmpl_iterate($template, "ELEM");
tmpl_set($template, array("ELEM/header" => $row['titel'], "ELEM/text" => $row['content']));
}
if ($params->POST->show != "all") {
tmpl_iterate($template, "LINKLIST");
}
return tmpl_parse($template);
}
示例12: profile_deleteAccount
function profile_deleteAccount($playerID, $data)
{
global $config, $db, $no_resource_flag, $params;
$no_resource_flag = 1;
// try to connect to login db
$db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME);
if (!$db_login) {
page_dberror();
}
// proccess form data
if (isset($data->confirm)) {
// the only necessary field
$success = profile_processDeleteAccount($playerID, $db_login);
$template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/deleteResponse.ihtml');
if ($success) {
session_destroy();
tmpl_set($template, 'message', "Ihr Account wurde zur Löschung vorgemerkt. " . "Sie sind jetzt ausgeloggt und können das Fenster " . "Schließen.");
tmpl_set($template, 'link', "http://tntchris.dyndns.org/ugaagga/");
} else {
tmpl_set($template, 'message', "Das löschen Ihres Accounts ist fehlgeschlagen." . "Bitte wenden Sie sich an das Support Team.");
tmpl_set($template, 'link', "ugastart.php");
}
return tmpl_parse($template);
}
// Show confirmation request
$template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
tmpl_set($template, 'message', "Möchten Sie Ihren Account unwiderruflich löschen? " . "Ihre gesamten Spieldaten gehen verloren, ein neuerliches " . "einloggen als dieser Spieler ist nicht möglich. " . "<p> Allerdings steht Ihnen die Emailadresse anschließend " . "für eine Neuanmeldung zur Verfügung." . "<p> Beachten Sie, daß Ihre Siedlung noch für einige " . "Zeit nach der Löschung für ander Spieler sichtbar ist, " . "da die Löschungen aus der Datenbank nur einmal am Tag " . "vorgenommen werden.");
tmpl_set($template, 'BUTTON/formname', 'confirm');
tmpl_set($template, 'BUTTON/text', 'Account löschen');
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', DELETE_ACCOUNT);
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
tmpl_iterate($template, 'BUTTON');
tmpl_set($template, 'BUTTON/formname', 'cancel');
tmpl_set($template, 'BUTTON/text', 'Abbrechen');
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', USER_PROFILE);
return tmpl_parse($template);
}
示例13: profile_deleteAccount
function profile_deleteAccount($playerID, $data)
{
global $config, $db, $no_resource_flag, $params;
$no_resource_flag = 1;
// try to connect to login db
$db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME);
if (!$db_login) {
page_dberror();
}
// proccess form data
if (isset($data->confirm)) {
// the only necessary field
$success = profile_processDeleteAccount($playerID, $db_login);
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'deleteResponse.ihtml');
if ($success) {
session_destroy();
tmpl_set($template, 'message', _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'));
tmpl_set($template, 'link', LOGIN_PATH);
} else {
tmpl_set($template, 'message', _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
tmpl_set($template, 'link', "ugastart.php");
}
return tmpl_parse($template);
}
// Show confirmation request
$template = tmpl_open($params->SESSION->player->getTemplatePath() . 'dialog.ihtml');
tmpl_set($template, 'message', _('Möchten Sie Ihren Account unwiderruflich löschen? Ihre gesamten Spieldaten gehen verloren, ein neuerliches einloggen als dieser Spieler ist nicht möglich. <br /> Allerdings steht Ihnen die Emailadresse anschließend für eine Neuanmeldung zur Verfügung. <br /> Beachten Sie, daß Ihre Höhle noch für einige Zeit nach der Löschung für andere Spieler sichtbar ist, da die Löschungen aus der Datenbank nur einmal am Tag vorgenommen werden.'));
tmpl_set($template, 'BUTTON/formname', 'confirm');
tmpl_set($template, 'BUTTON/text', _('Account löschen'));
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', DELETE_ACCOUNT);
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
tmpl_iterate($template, 'BUTTON');
tmpl_set($template, 'BUTTON/formname', 'cancel');
tmpl_set($template, 'BUTTON/text', _('Abbrechen'));
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', USER_PROFILE);
return tmpl_parse($template);
}
示例14: getContent
function getContent($modus)
{
global $db_login, $params, $cfg;
$content = "";
switch ($modus) {
case 'news_create':
$template = tmpl_open("modules/Module_News/templates/create.ihtml");
// Form Submitted
if (isset($params->creator)) {
$sql = "INSERT INTO `Portal_news` (`newsID`, `category`, `archive`, " . "`author`, `date`, `title`, `content`) " . "VALUES (0, '" . $params->newsCategory . "', '" . "0" . "', '" . $params->newsAuthor . "', '" . $params->newsDate . "', '" . $params->newsTitle . "', '" . nl2br(lib_bb_code($params->newsContent)) . "')";
if (!$db_login->query($sql)) {
die("Datenbankfehler beim Eintragen der News!");
}
tmpl_set($template, "MESSAGE/message", "News eingetragen!");
} else {
foreach ($cfg['news']['categories'] as $category) {
tmpl_iterate($template, '/FORM/CATEGORY');
tmpl_set($template, '/FORM/CATEGORY', array('text' => $category, 'value' => $category));
}
tmpl_set($template, '/FORM/date', date("d-m-Y"));
}
$content = tmpl_parse($template);
break;
case 'news_show':
$template = tmpl_open("modules/Module_News/templates/show.ihtml");
$sql = "SELECT * FROM Portal_news ORDER BY newsID DESC";
$result = $db_login->query($sql);
if (!$result || $result->isEmpty()) {
return "Error while retrieving news!";
}
$news = array();
while ($row = $result->nextRow()) {
$news[] = $row;
}
tmpl_set($template, 'NEWS', $news);
$content = tmpl_parse($template);
break;
}
return $content;
}
示例15: cave_giveUpConfirm
function cave_giveUpConfirm($caveID)
{
global $config, $db, $params;
// Show confirmation request
$template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
tmpl_set($template, 'message', "Möchten Sie die Siedlung {$caveID} wirklich aufgeben? Sie " . "verlieren die Kontrolle über alle Rohstoffe und alle " . "Einheiten, die sich hier befinden!");
tmpl_set($template, 'BUTTON/formname', 'confirm');
tmpl_set($template, 'BUTTON/text', 'Aufgeben');
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', CAVE_DETAIL);
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'caveGiveUpConfirm');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
tmpl_iterate($template, 'BUTTON/ARGUMENT');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'giveUpCaveID');
tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', $caveID);
tmpl_iterate($template, 'BUTTON');
tmpl_set($template, 'BUTTON/formname', 'cancel');
tmpl_set($template, 'BUTTON/text', 'Abbrechen');
tmpl_set($template, 'BUTTON/modus_name', 'modus');
tmpl_set($template, 'BUTTON/modus_value', CAVE_DETAIL);
return tmpl_parse($template);
}