本文整理汇总了PHP中render函数的典型用法代码示例。如果您正苦于以下问题:PHP render函数的具体用法?PHP render怎么用?PHP render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zone_agenda
public function zone_agenda($id_c, $choix)
{
try {
if ($id_c != 0) {
$animal = requetemysql::findunanimal2(array('id_ani' => $id_c));
if (empty($animal)) {
throw new Exception("Error in findunanimal2 function ! param : id_ani: " + $id_c);
}
} else {
$animal = json_encode($id_c);
}
// liste des vétos du tour de garde
$vetos = requetemysql::listevetos();
if (empty($vetos)) {
throw new Exception("Error in listevetos fonction !");
}
if ($choix == "week") {
render('_agenda', array('title' => 'Agenda partagé du tour de garde', 'animal' => $animal, 'liste_vetos' => $vetos));
} elseif ($choix == "day") {
render('_agenda2', array('title' => 'Agenda du ' + date("d/m/y"), 'animal' => $animal, 'liste_vetos' => $vetos));
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
示例2: index_index
function index_index()
{
$data = array();
$data['template_file'] = 'admin/index.php';
$data['title'] = 'Trang Admin';
render('layout_admin.php', $data);
}
示例3: bill_detail
function bill_detail()
{
$data = array();
$user = adminLogged();
if (!adminLogged()) {
redirect('/index.php?c=admin&m=login');
} else {
$bill_detail = model('bill')->getBillDetails($_GET['id']);
$data['total'] = 0;
foreach ($bill_detail as $key => $b) {
$book = model('book')->getSingle($b['book_id']);
$bill_detail[$key]['name'] = $book['name'];
$bill_detail[$key]['price'] = intval($book['price']);
$bill_detail[$key]['total'] = $book['price'] * $b['quantity'];
$bill_detail[$key]['image'] = $book['image'];
$data['total'] += $book['price'] * $b['quantity'];
}
$data['bill_detail'] = $bill_detail;
}
$data['statuses'] = array('Chờ duyệt', 'Đang giao hàng', 'Đã giao hàng', 'Hủy');
$data['stt'] = model('bill')->getOneBy($_GET['id'], null)['status'];
if (isPostRequest()) {
$postData = postData();
db_update('bills', $postData, 'id=' . $_GET['id']);
$data['stt'] = $postData['status'];
$data['error'] = 'Tình trạng đơn hàng update thành công.';
}
$data['user'] = model('user')->getOneBy(model('bill')->getOneBy($_GET['id'], null)['user_id'], null);
$data['template_file'] = 'bill/detail.php';
render('layout.php', $data);
}
示例4: testWhosOnlineBlock
/**
* Test the Who's Online block.
*/
function testWhosOnlineBlock()
{
$block = $this->drupalPlaceBlock('views_block:who_s_online-who_s_online_block');
// Generate users.
$user1 = $this->drupalCreateUser(array('access user profiles'));
$user2 = $this->drupalCreateUser(array());
$user3 = $this->drupalCreateUser(array());
// Update access of two users to be within the active timespan.
$this->updateAccess($user1->id());
$this->updateAccess($user2->id(), REQUEST_TIME + 1);
// Insert an inactive user who should not be seen in the block, and ensure
// that the admin user used in setUp() does not appear.
$inactive_time = REQUEST_TIME - 15 * 60 - 1;
$this->updateAccess($user3->id(), $inactive_time);
$this->updateAccess($this->adminUser->id(), $inactive_time);
// Test block output.
\Drupal::currentUser()->setAccount($user1);
$content = entity_view($block, 'block');
$this->drupalSetContent(render($content));
$this->assertRaw(t('2 users'), 'Correct number of online users (2 users).');
$this->assertText($user1->getUsername(), 'Active user 1 found in online list.');
$this->assertText($user2->getUsername(), 'Active user 2 found in online list.');
$this->assertNoText($user3->getUsername(), 'Inactive user not found in online list.');
$this->assertTrue(strpos($this->drupalGetContent(), $user1->getUsername()) > strpos($this->drupalGetContent(), $user2->getUsername()), 'Online users are ordered correctly.');
}
示例5: home_index
function home_index()
{
$data = array();
$data['template_file'] = 'index/index.php';
$data['title'] = 'Trang chủ';
render('layout_home.php', $data);
}
示例6: linkSimple
public function linkSimple($label, $path, $image = null)
{
$url = \Meta\Builder::replaceURL(\Meta\Builder::replaceOutput($this->row, $path));
$label = \Meta\Builder::replaceOutput($this->row, $label);
$link = render('builder-link.php', array('url' => $url, 'label' => $label, 'img' => $image));
return $link;
}
示例7: error_message
/**
* Renders an error message.
*/
function error_message($message)
{
render('header', ['title' => 'Error']);
render('error_message', ['message' => $message]);
render('footer');
exit;
}
示例8: main
function main()
{
// создаем сессию
session_start();
if (is_current_user()) {
// если пользователь уже залогинен, то отправляем его на глапную
redirect('./');
}
if (is_postback()) {
// обрабатываем отправленную форму
$dbh = db_connect();
$post_result = register_user($dbh, $user, $errors);
db_close($dbh);
if ($post_result) {
// перенаправляем на главную
redirect('./');
} else {
// информация о пользователе заполнена неправильно, выведем страницу с ошибками
render('register_form', array('form' => $_POST, 'errors' => $errors));
}
} else {
// отправляем пользователю чистую форму для регистрации
render('register_form', array('form' => array(), 'errors' => array()));
}
}
示例9: view_all
public static function view_all()
{
global $db;
$query = $db->query('SELECT * FROM scores ORDER BY userid,service');
set('scores', $query->fetchAll(PDO::FETCH_OBJ));
return render('home.php');
}
示例10: events_show
function events_show()
{
global $event;
$event = new Event();
$event = $event->find($_GET['id']);
render();
}
示例11: content_ajax_page_fc
private function content_ajax_page_fc($fcid)
{
$fcitem = \Drupal\field_collection\Entity\FieldCollectionItem::load($fcid);
$target = WG::entity_get_field_value($fcitem, 'field_target');
preg_match('%^([^:]+)://([0-9]+)$%', $target, $m);
$itemtype = $m[1];
$id = $m[2];
switch ($itemtype) {
case 'public318':
$identifier = $id;
$text = WG::entity_get_field_formatted_text($fcitem, 'field_annotation');
$stylename = 'large';
$icon_uri = _expo_public318_get_icon_uri($identifier);
$icontag = WG::render_styled_image($icon_uri, $stylename);
$output = '<div class="sticky-fc-public318">' . '<div class="collicon">' . _expo_coll_url($identifier, $icontag) . '</div>' . '<div class="colltext">' . $text . '</div>' . '</div>';
break;
case 'storynode':
$nid = $id;
$story = node_load($nid);
$v = entity_view($story, 'ajaxpage');
$output = render($v);
break;
default:
$tag = "<div class=\"sticky\" id=\"sticky_{$pos}\">" . $itemtype . $pos . "</div>";
}
$build = ['#markup' => $output];
return $build;
}
示例12: sms_coupon
function sms_coupon($coupon, $mobile = null)
{
global $INI;
if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
return $INI['system']['couponname'] . '已失效';
}
$user = Table::Fetch('user', $coupon['user_id']);
$order = Table::Fetch('order', $coupon['order_id']);
if (!Utility::IsMobile($mobile)) {
$mobile = $order['mobile'];
if (!Utility::IsMobile($mobile)) {
$mobile = $user['mobile'];
}
}
if (!Utility::IsMobile($mobile)) {
return '请设置合法的手机号码,以便接受短信';
}
$team = Table::Fetch('team', $coupon['team_id']);
$partner = Table::Fetch('partner', $coupon['partner_id']);
$coupon['end'] = date('Y-n-j', $coupon['expire_time']);
$coupon['name'] = $team['product'];
$content = render('manage_tpl_smscoupon', array('partner' => $partner, 'coupon' => $coupon, 'user' => $user));
if (true === ($code = sms_send($mobile, $content))) {
Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1'), 'sms_time' => time()));
return true;
}
return $code;
}
示例13: index
function index()
{
modTitle('Planit | Deconnexion');
setAlert('Vous êtes bien déconnecté, redirection vers la page d\'accueil dans 5 secondes', 'danger');
deco();
render();
}
示例14: gen_cmd_pages
function gen_cmd_pages($cmd, $parent = array())
{
$parent[] = $cmd['name'];
$binding = $cmd;
$binding['synopsis'] = implode(' ', $parent);
$binding['path'] = implode('/', $parent);
$binding['has-subcommands'] = isset($cmd['subcommands']) ? array(true) : false;
if ($cmd['longdesc']) {
$docs = $cmd['longdesc'];
$docs = htmlspecialchars($docs, ENT_COMPAT, 'UTF-8');
// decrease header level
$docs = preg_replace('/^## /m', '### ', $docs);
// escape `--` so that it doesn't get converted into `—`
$docs = preg_replace('/^(\\[?)--/m', '\\1\\--', $docs);
$docs = preg_replace('/^\\s\\s--/m', ' \\1\\--', $docs);
// hack to prevent double encoding in code blocks
$docs = preg_replace('/ < /', ' < ', $docs);
$docs = preg_replace('/ > /', ' > ', $docs);
$docs = preg_replace('/ <</', ' <<', $docs);
$docs = preg_replace('/"/', '"', $docs);
$binding['docs'] = $docs;
}
$path = __DIR__ . "/commands/" . $binding['path'];
if (!is_dir($path)) {
mkdir($path);
}
file_put_contents("{$path}/index.md", render('subcmd-list.mustache', $binding));
if (!isset($cmd['subcommands'])) {
return;
}
foreach ($cmd['subcommands'] as $subcmd) {
gen_cmd_pages($subcmd, $parent);
}
}
示例15: plugin_basic_auth
function plugin_basic_auth()
{
$data['bauth_username'] = kget('bauth_username');
$data['bauth_password'] = kget('bauth_password');
$data['bauth_on'] = kget('bauth_on');
return render($data, 'ajax', 'plugin', 'basic_auth');
}