本文整理匯總了PHP中template::add_data方法的典型用法代碼示例。如果您正苦於以下問題:PHP template::add_data方法的具體用法?PHP template::add_data怎麽用?PHP template::add_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類template
的用法示例。
在下文中一共展示了template::add_data方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: template
<?php
include_once './template.php';
include_once './sqllink.php';
include_once 'secure.php';
$boardid = $_GET['boardid'];
\SECURE\sql_secure($boardid);
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("userinfo.js");
$webcontent->add_rely("animation.js");
$sqline = $db->query("select * from all_board_info where link='{$boardid}'")->fetch();
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>' . $sqline['name'] . ' - 主題列表</div></div><div class="data">');
$webcontent->add_data('本版標簽 ');
foreach (split(",", $sqline['labels']) as $value) {
$webcontent->add_data('<a class="label" link="label" name=' . $value . '>' . $value . '</a>');
}
$webcontent->add_data('<br>');
if (isset($_SESSION['userid'])) {
$webcontent->add_data('<a link="write" name=' . $boardid . ' cate=0>' . 發表文章 . '</a> ');
$webcontent->add_data('| <a link="write" name=' . $boardid . ' cate=1>' . 發表議題 . '</a> ');
}
if ($_SESSION['rank'] >= 8) {
$webcontent->add_data('| <a id="setboard">管理板塊</a> ');
}
$sqline = $db->query("select count(*) from board_admin where board='{$boardid}'")->fetch();
$total = intval($sqline[0]);
$offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0;
示例2: template
$data[] = $value['content'] . '<p id=' . $value['id'] . ' iteminfo>' . $value['time'] . '</p>';
}
}
echo json_encode($data);
return;
}
if ($_POST['func'] == 'delete') {
$db->exec("delete from inform where id={$_POST['id']}");
return;
}
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("notice.js");
$sqline = $db->query("select * from inform where user_id={$_SESSION['userid']}")->fetchAll();
$webcontent->add_data('<p id="articleid" style="display:none">' . $articleid . "</p>");
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>最新通知</div></div><div class="data">');
$webcontent->add_data('<br><br>');
if (count($sqline) == 0) {
$webcontent->add_data('無最新消息');
} else {
foreach ($sqline as $value) {
$value['content'] = preg_replace("/\n/", "<br>", $value['content']);
$webcontent->add_data('<div class="dataitem">' . $value['content'] . '<p iteminfo>' . $value['time'] . ' <a class="deleteinfo" name=' . $value['id'] . '>我知道啦</a></p></div>');
}
}
$webcontent->add_data('</div></div>');
include_once './blade.php';
示例3: template
<?php
include_once './template.php';
include_once './sqllink.php';
include_once './secure.php';
$label = $_GET['label'];
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("userinfo.js");
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>' . $label . '的搜索結果</div></div><div class="data">');
$webcontent->add_data('<br><br>');
$sqline = $db->query("select count(*) from board_admin where labels like '%{$label}%'")->fetch();
$total = intval($sqline[0]);
$offset = isset($_GET['page']) ? intval($_GET['page']) * 7 : 0;
$sqline = $db->query("select * from board_admin where labels like '%{$label}%' order by date DESC limit {$offset},7");
foreach ($sqline->fetchAll() as $row) {
$result = $db->query("select username from user where id={$row['author_id']}")->fetch();
\SECURE\kill_html($row['title']);
\SECURE\kill_html($row['labels']);
\SECURE\kill_html($row['content']);
\SECURE\_short($row['content']);
$webcontent->add_data('<div class="dataitem articleinfo" ' . ($row['checks'] > 100 ? 'hot' : '') . '><a item link="article" id=' . $row['id'] . '>' . $row['title'] . '</a><p>' . $row['content'] . '</p>');
$webcontent->add_data('<p iteminfo><a user link="user" id=' . $row['author_id'] . '>' . $result['username'] . '</a> 發表於 ' . $row['date'] . " 被讚{$row['favor']}次 回複{$row['comment']} 查看{$row['checks']}</p></div>");
}
if ($total > 7) {
$_GET['page'] = intval($_GET['page']);
for ($i = 0; $i < $total / 7 && $i < 7; $i++) {
示例4: template
echo "./article.php?articleid={$sqline}";
return;
}
$articleid = $_GET['articleid'];
// 0 文章,作者重要; 1 提問或議題,作者不重要
$boardid = $_GET['boardid'];
$webcontent = new template();
$articleid = $articleid === "1" ? "議題" : "文章";
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("interact.js");
$webcontent->add_rely("write.js");
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec green></span><div navi-top-bar>發表' . $articleid . '</div></div><div class="data">');
$webcontent->add_data("<div class='dataitem'><form><div class='form-group'><h3>標題</h3><label for='title'>請在此輸入標題。</label><input id='con_title' class='form-control' placeholder='標題'>\n\t</div>");
$webcontent->add_data("<div class='form-group'><h3>正文</h3><label for='title'>正文內容不得少於10個字符。</label><textarea class='form-control' id='con_body'></textarea>\n\t</div>");
$webcontent->add_data("<div class='form-group'><h3>標簽</h3><label for='title'>設置標簽以方便尋找。</label><br>");
$sqline = $db->query("select labels from all_board_info where link='{$boardid}'")->fetch();
foreach (split(",", $sqline['labels']) as $value) {
$webcontent->add_data("<span class='write_label'>{$value}</span>");
}
$webcontent->add_data("<input disabled class='form-control' id='labels' placeholder='通過選擇已有標簽來更改'></div>");
if ($articleid == "議題") {
$another = $db->query("select money from user where id={$_SESSION['userid']}")->fetch();
$webcontent->add_data("<div class='form-group'><h3>議題酬金</h3><label for='title'>\n\t\t在發表議題的情況下,你可以設置酬金,參與者將根據貢獻獲得酬金。酬金範圍0-50,您隻需要支付50%,超過50的部分全部由您自負。</label>\n\t\t<p iteminfo>您的可用財產 {$another['money']}</p><input class='form-control' placeholder='酬金大小' id='money' value='0'>\n\t</div>");
}
$webcontent->add_data('<input type="text" style="display:none" id="cate" value="' . ($articleid == "文章" ? 0 : 1) . '"">');
$webcontent->add_data('<input type="text" style="display:none" id="boardid" value="' . $boardid . '"">');
$webcontent->add_data('<a id="submit" class="btn btn-default" onclick="submit()" role="button">發表</a> <a class="btn btn-default" onclick="back()" role="button">返回</a></form></div>');
示例5: template
<?php
include_once './template.php';
include_once './sqllink.php';
$webcontent = new template();
$webcontent->set_title('極端討論區');
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->add_rely("animation.js");
$db->exec("set names utf8");
if ($db->errorCode() != '00000') {
return;
}
$sqline = $db->query("select * from all_board_info")->fetchAll();
if (isset($_SESSION["userid"])) {
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>我的定製</div></div><div class="data">');
$my = $db->query("select board_config from user where id={$_SESSION['userid']}")->fetch();
foreach (split(",", $my['board_config']) as $value) {
if (strlen($value) != 0) {
$more = $db->query("select * from all_board_info where name='{$value}'")->fetch();
$count = $db->query("select title,id,DATE_FORMAT(date,'%H:%I:%s') as time from board_admin where board='{$more['link']}' and DATE_FORMAT(date,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')")->fetchAll();
$webcontent->add_data('<a link="board" id=' . $more['link'] . ' page=0><div class="bconfig"><p>來自 <heavy>' . $more['name'] . '</heavy> 的推送</p><span>' . count($count) . '</span><div>');
foreach ($count as $key) {
$webcontent->add_data($key['title'] . ' 發表於' . $key['time'] . '<br>');
}
$webcontent->add_data('</div></div></a>');
}
}
$webcontent->add_data('</div></div>');
}
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec green></span><div navi-top-bar>板塊列表</div></div><div class="data">');
foreach ($sqline as $value) {
示例6: template
<?php
include_once './template.php';
include_once './sqllink.php';
if ($_POST['func'] == 'get') {
$sqline = $db->query("select * from end_info where article_id={$_POST['id']}")->fetchAll();
if (count($sqline) == 0) {
echo 0;
return;
} else {
echo $sqline[0]['data'];
return;
}
}
$articleid = $_GET['articleid'];
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("endinfo.js");
$sqline = $db->query("select * from board_admin where id={$articleid}")->fetch();
$webcontent->add_data('<p id="articleid" style="display:none">' . $articleid . "</p>");
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>' . $sqline['title'] . '的結題情況</div></div><div class="data">');
$webcontent->add_data('<br><br>');
$webcontent->add_data('</div></div>');
include_once './blade.php';
示例7: template
} else {
echo $sqline[0]['data'];
return;
}
}
$articleid = $_GET['articleid'];
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("interact.js");
$webcontent->add_rely("favor.js");
$sqline = $db->query("select * from relation where object={$_SESSION['userid']}")->fetchAll();
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>關注列表</div></div><div class="data">');
$webcontent->add_data('<h4>你關注的人</h4>');
foreach ($sqline as $value) {
$userinfo = $db->query("select * from user where id={$value['subject']}")->fetch();
$webcontent->add_data('<div style="display:inline-block"><img infoheadpic src="http://www.gravatar.com/avatar/' . md5($userinfo['email']) . '?s=128"><a link="user" id=' . $userinfo['id'] . '><h5>' . $userinfo['username'] . '</h5></a></div>');
}
$webcontent->add_data('<br><br><h4>你關注的回複</h4>');
$sqline = $db->query("select * from comment_favor_data where user_id={$_SESSION['userid']}")->fetchAll();
foreach ($sqline as $value) {
$userinfo = $db->query("select * from board_admin_c where id={$value['comment_id']}")->fetch();
\SECURE\kill_html($userinfo['title']);
\SECURE\kill_html($userinfo['content']);
\SECURE\_format($userinfo['content']);
$webcontent->add_data('<div class="dataitem"><h3><a link="article" id=' . $userinfo['article_index'] . '>' . $userinfo['title'] . '</a></h3>' . $userinfo['content'] . '關注於' . $value['time'] . ' <a cid="' . $value['comment_id'] . '" class="cancelf">取消關注</a></div>');
}
$webcontent->add_data('<br><br>');
示例8: template
return;
} else {
echo 1;
return;
}
}
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("interact.js");
$webcontent->add_rely("title.js");
$sqline = $db->query("select * from title_info")->fetchAll();
$webcontent->add_data('<p id="articleid" style="display:none">' . $articleid . "</p>");
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>稱號列表</div></div><div class="data">');
$webcontent->add_data('<br>');
foreach ($sqline as $value) {
$req = "";
foreach (split(",", $value['requisition']) as $key) {
$req .= preg_replace_callback("/([a-z]+)(\\d+):(\\d+)/", function ($matches) use($db) {
switch ($matches[1]) {
case 'all':
$board = '在 全部板塊 ';
break;
case 'listen':
$board = '你關注的人的數目 ';
break;
case 'favor':
$board = '關注你的人 ';
示例9: intval
$article_cate = intval($sqline['cate']);
// 0 文章,作者重要; 1 提問或議題,作者不重要
$webcontent = new template();
$webcontent->set_title("極端討論區");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->helloword();
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("interact.js");
$webcontent->add_rely("sh/shCore.js");
$webcontent->add_rely("sh/shAutoloader.js");
$webcontent->add_rely("sh/shBrushJScript.js");
$webcontent->add_rely("article.js");
$webcontent->add_rely("userinfo.js");
$webcontent->add_rely("sh/shCoreDefault.css");
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>' . $sqline['title'] . '</div></div><div class="data">');
foreach (split(",", $sqline['labels']) as $value) {
$webcontent->add_data('<a class="label" link="label" name=' . $value . '>' . $value . '</a>');
}
$webcontent->add_data("<br>");
$webcontent->add_data(' 返回 <a type="getback" link="' . $sqline['board'] . '">' . $result['name'] . '</a> ');
if ($_SESSION['rank'] >= 8) {
$webcontent->add_data('| <a id="deletea">刪除內容</a> ');
}
if (intval($_SESSION['userid']) == intval($sqline['author_id']) || $_SESSION['rank'] >= 8) {
$webcontent->add_data('| <a id="changea">編輯內容</a> ');
}
$result = $db->query("select * from user where id={$sqline['author_id']}")->fetch();
if ($article_cate == 1 || $article_cate == 2) {
if ($article_cate == 2) {
$endinfo = $db->query("select * from end_info where article_id={$articleid}")->fetch();
示例10: count
return;
}
$sqline = $db->query("select * from user where id={$userid}")->fetch();
$listen = $db->query("select count(*) from relation where subject={$userid}")->fetch();
$talk1 = $db->query("select count(*) from board_admin where author_id={$userid}")->fetch();
$talk2 = $db->query("select count(*) from board_admin_c where author_id={$userid}")->fetch();
$favor = "";
if (isset($_SESSION['userid'])) {
$relation = $db->query("select count(*) from relation where subject={$userid} and object={$_SESSION['userid']}")->fetch();
if (intval($relation[0]) == 1) {
$favor = "已關注<a id='cancell'>(取消關注)</a>";
} else {
$favor = "<a id='addl'>關注他</a>";
}
}
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec></span><div navi-top-bar>個人資料</div></div><div class="data">');
$webcontent->add_data('<div class="author"><div class="left"><img infoheadpic src="http://www.gravatar.com/avatar/' . md5($sqline['email']) . '?s=128"></div><h3>' . $sqline['username'] . '</h3> ' . $favor . ' uid=<span id="userid">' . $userid . '</span><br><p iteminfo>' . ($sqline['rank'] == '9' ? '管理員' : $sqline['rank']) . '<br>' . $sqline['sign'] . '</p>發言 ' . (intval($talk1[0]) + intval($talk2[0])) . '次 被讚 ' . $sqline['favor'] . '次 ' . $listen[0] . '人關注<p>' . $sqline['titles'] . '</p></div>');
$webcontent->add_data('</div></div>');
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec green></span><div navi-top-bar>最新動態</div></div><div class="data">');
$webcontent->add_data('</div></div>');
$webcontent->add_data('<div class="datadiv"><div leftnavi><span top-dec gry></span><div navi-top-bar>他的發言</div></div><div class="data" id="talkdata">');
$count = $db->query("select count(*) from board_admin where author_id={$userid}")->fetch();
$count = intval($count[0]);
$sqline = $db->query("select * from board_admin where author_id={$userid} order by date DESC limit 7")->fetchAll();
foreach ($sqline as $value) {
\SECURE\kill_html($value['title']);
\SECURE\kill_html($value['labels']);
\SECURE\kill_html($value['content']);
\SECURE\_short($value['content']);
$webcontent->add_data('<div class="dataitem articleinfo"><a item link="article" id=' . $value['id'] . '>' . $value['title'] . '</a><p>' . $value['content'] . '</p><p iteminfo>發表於 ' . $value['date'] . " 被讚{$value['favor']}次 回複{$value['comment']} 查看{$value['checks']}</p></div>");
}
示例11: values
include_once './sqllink.php';
if (!isset($_SESSION['userid'])) {
return;
}
$sqline = $db->query("select username,rank from user where id={$_SESSION['userid']}")->fetch();
if (intval($sqline['rank']) < 8) {
echo $sqline['rank'];
return;
}
switch ($_POST['func']) {
case 'deleteArticle':
$db->exec("delete from board_admin where id={$_POST['param']['id']}");
$db->exec("insert into admin_logs values({$_SESSION['userid']},now(),'deleteArticle,{$_POST['param']['reason']}')");
return;
break;
default:
# code...
break;
}
$webcontent = new template();
$webcontent->set_title("管理站點");
$webcontent->set_subtitle('Welcome to a place of pure boredness.');
$webcontent->add_rely("default.css");
$webcontent->add_rely("animation.js");
$webcontent->add_rely("interact.js");
$webcontent->add_rely("admin.js");
$webcontent->add_data("<h3>管理員{$sqline['username']},您好!</h3><br>");
$webcontent->add_data("<a class='change' web='./boardconfig.php'>板塊管理</a> | <a class='change' web='./userconfig.php'>用戶管理</a> | <a class='change' web='./titleconfig.php'>稱號管理</a> | <a class='change' web='./logs.php'>管理日記</a><br>");
$webcontent->add_data("需要後台使用手冊?沒有這種東西!蛤!雙擊需要改的那一格就可以啦。<br><br>");
$webcontent->add_data("<div id='config-container'><h3>管理版麵第一版。沒有什麽實用的功能嗯。</h3></div>");
include_once './blade.php';