本文整理汇总了PHP中render_view函数的典型用法代码示例。如果您正苦于以下问题:PHP render_view函数的具体用法?PHP render_view怎么用?PHP render_view使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render_view函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_email
function send_email($to, $data, $template, $subject = 'No Subject', $reply_to = false, $attachments = false)
{
global $email_from;
$boundary = uniqid('veev');
$boundar2 = uniqid('inner');
$headers = 'From: ' . $email_from . ($reply_to == false ? '' : "\r\n" . 'Sender: ' . $email_from . "\r\n" . 'Reply-To: ' . $reply_to) . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/related; boundary=' . $boundary . "\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: multipart/alternative; boundary=' . $boundar2 . "\r\n";
//
$message = render_view('email/' . $template . '.php', $data);
//
$message = "\r\n" . '--' . $boundar2 . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n\r\n" . strip_tags($message) . "\r\n\r\n--" . $boundar2 . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n\r\n" . $message . "\r\n\r\n" . '--' . $boundar2 . '--' . "\r\n" . '--' . $boundary;
if ($attachments !== false) {
foreach ($attachments as $filename => $data) {
if (!isset($data) && file_exists($filename)) {
$data = base64_encode(file_get_contents($filename));
$filename = substr($filename, strrpos($filename, '/') + 1);
} else {
if (strlen($data) < 128 && file_exists($data)) {
$data = base64_encode(file_get_contents($data));
}
}
$message .= "\r\n" . 'Content-Type: application/octet-stream; name="' . $filename . '"' . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" . 'Content-Disposition: attachment' . "\r\n\r\n" . $data . "\r\n--" . $boundary;
}
}
$message .= '--';
$mail_sent = @mail($to, $subject, $message, $headers);
return $mail_sent;
}
示例2: onBefore
public function onBefore()
{
//render header
if (!$this->isAjax()) {
render_view("header");
}
}
示例3: show_form
function show_form()
{
$name = _req('name');
$teacher = _req('teacher');
$description = _req('description');
$teachers = Teacher::search()->find(Searcher::KEY_VALUE_PAIR);
render_view('master', compact('teachers', 'name', 'teacher', 'description'));
}
示例4: show_form
function show_form()
{
$genders = $GLOBALS['config']['gender'];
$name = _req('name');
$gender = _req('gender');
$description = _req('description');
render_view('master', compact('genders', 'name', 'gender', 'description'));
}
示例5: comment_add_GET
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function comment_add_GET($teacher, $comment)
{
$has_login = $GLOBALS['has_login'];
if (!$has_login) {
return;
}
$teacher = new Teacher($teacher);
$comment = new Comment($comment);
render_view('master', compact('teacher', 'comment', 'has_login'));
}
示例6: register_GET
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function register_GET()
{
if ($GLOBALS['has_login']) {
redirect();
}
$config = $GLOBALS['config'];
$genders = $config['gender'];
$schools = $config['school'];
render_view('master', compact('genders', 'schools'));
}
示例7: index
/**
* @file index
* @author ryan <cumt.xiaochi@gmail.com>
* @created Jun 27, 2012 6:24:01 PM
*/
function index()
{
$recentTeachers = Teacher::search()->orderBy('touched DESC')->find();
$recentComments = Comment::search()->OrderBy('id DESC')->find();
$data = compact('recentTeachers', 'recentCourses', 'recentComments');
if ($GLOBALS['has_login']) {
$timelines = Timeline::search()->filterBy('user', $GLOBALS['user'])->find();
$data['timelines'] = $timelines;
}
render_view('master', $data);
}
示例8: login_end
function login_end()
{
// if user is already logged in,
// to index since we didn't provide such a link
if ($GLOBALS['has_login']) {
redirect();
// to index
}
$username = _req('username');
render_view('master', array('msg' => $GLOBALS['msg'], 'username' => $username));
}
示例9: teacher_GET
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function teacher_GET($id)
{
$teacher = new Teacher($id);
$comments = Comment::search()->filterBy('teacher', $id)->find();
$has_login = $GLOBALS['has_login'];
if ($has_login) {
$teacher->commentedByMe = $teacher->commentedByUser($GLOBALS['user']);
}
$schools = $GLOBALS['config']['school'];
render_view('master', compact('teacher', 'courses', 'comments', 'has_login', 'schools'));
}
示例10: send_email
function send_email($to, $data, $template, $subject = 'No Subject', $reply_to = false, $attachments = false)
{
global $email_from, $admin_email;
$boundary = uniqid('np');
$headers = 'To: ' . $to . "\r\n" . 'From: ' . $email_from . ($reply_to == false ? '' : "\r\n" . 'Sender: ' . $email_from . "\r\n" . 'Reply-To: ' . $reply_to) . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/alternative; boundary=' . $boundary . "\r\n";
//
$message = render_view('email/' . $template . '.php', $data);
//
$message = strip_tags($message) . "\r\n\r\n--" . $boundary . "\r\n" . 'Content-type: text/html;charset=utf-8' . "\r\n\r\n" . $message . "\r\n\r\n--" . $boundary . '--';
$mail_sent = @mail($to, $subject, $message, $headers);
return $mail_sent;
}
示例11: course_GET
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function course_GET($id)
{
$course = new Course($id);
$teacher = $course->teacher();
$comments = $course->comments();
$has_login = $GLOBALS['has_login'];
$data = compact('course', 'teacher', 'canStar', 'has_login', 'comments');
if ($has_login) {
$data['myStar'] = $course->starBy($GLOBALS['user']);
}
render_view('master', $data);
}
示例12: frontend_render_cell_content
function frontend_render_cell_content($target)
{
global $ddl_fields_api;
$ddl_fields_api->set_current_cell_content($this->get_content());
if (function_exists('render_view')) {
global $WPV_view_archive_loop, $wp_query;
$WPV_view_archive_loop->query = clone $wp_query;
$WPV_view_archive_loop->in_the_loop = true;
$target->cell_content_callback(render_view(array('id' => get_ddl_field('ddl_layout_view_id'))), $this);
$WPV_view_archive_loop->in_the_loop = false;
} else {
$target->cell_content_callback(WPDDL_Messages::views_missing_message(), $this);
}
}
示例13: comment
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function comment($teacher, $comment)
{
$teacher = new Teacher($teacher);
$comment = new Comment($comment);
$additions = $comment->additions();
$discusses = $comment->discusses();
$has_login = $GLOBALS['has_login'];
if ($has_login) {
$u = $GLOBALS['user'];
$comment->likedByMe = $comment->attitudeByUser('like', $u);
$comment->hatedByMe = $comment->attitudeByUser('hate', $u);
$commentedByMe = $comment->user == $u->id;
}
render_view('master', compact('teacher', 'comment', 'has_login', 'discusses', 'commentedByMe', 'additions'));
}
示例14: exceptionHandler
/**
* handle exception in runtime
*
* @param Exception $exception exception to handle
*/
public function exceptionHandler($exception)
{
$message = $exception->getMessage();
render_view("exception", array("message" => $message));
render_view("footer");
exit;
}
示例15: render_view
/*
* Making sure Wordless plugin is enabled
*/
if (!class_exists("Wordless")) {
echo "This theme requires the <a href='https://github.com/welaika/wordless'>Wordless plugin</a> in order to work. Please, install it now!";
die;
}
/*
* In this page, you need to setup Wordless routing: you first
* determine the type of the page using WordPress conditional tags,
* and then delegate the rendering to some particular view using
* the `render_view()` helper.
*
* To specify a layout other than the default one, please pass it as
* the second parameter to the `render_view()` method.
*
* For a list of conditional tags, please see here: http://codex.wordpress.org/Conditional_Tags
*/
if (is_front_page()) {
// Home Template
render_view("pages/home");
} elseif (is_single()) {
// Single Post on Blog Template
render_view("posts/single");
} elseif (is_page()) {
// Single Page Template
render_view("pages/single");
} else {
// Archive Template
render_view("posts/archive");
}