当前位置: 首页>>代码示例>>PHP>>正文


PHP PageRenderer::render方法代码示例

本文整理汇总了PHP中PageRenderer::render方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::render方法的具体用法?PHP PageRenderer::render怎么用?PHP PageRenderer::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PageRenderer的用法示例。


在下文中一共展示了PageRenderer::render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: switch

    $user = get_login_user();
    switch ($module) {
        case 'EventCalendarModule':
            $obj->assoc_type = 'user';
            $obj->assoc_id = (int) $_SESSION['user']['id'];
            $obj->may_edit = true;
            // user may edit own events, right? ;)
            $obj->assoc_title = $user->login_name;
            break;
    }
    $obj->mode = PUB;
}
$page = new PageRenderer("setup_module", PAGE_CALENDAR, "Calendar - PeopleAggregator", "container_one_column.tpl", "header_user.tpl", NULL, PRI, $network_info);
$theme_details = get_user_theme($login_uid);
if (is_array($theme_details['css_files'])) {
    foreach ($theme_details['css_files'] as $key => $value) {
        $page->add_header_css($value);
    }
}
$css_path = $current_theme_path . '/calendar.css';
$page->add_header_css($css_path);
$page->add_header_html(js_includes('calendar.js'));
if (!empty($msg)) {
    $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/display_message.tpl");
    $msg_tpl->set('message', $msg);
    $page->add_module("middle", "top", $msg_tpl->fetch());
}
$page->add_header_html($parameter);
// uihelper_get_group_style($gid);
echo $page->render();
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:30,代码来源:calendar.php

示例2: exception_handler

function exception_handler($exception)
{
    global $current_theme_path;
    // clean out any buffering so we can write straight to the client
    while (@ob_end_clean()) {
    }
    try {
        while ($exception->getCode() == 100 && strpos($exception->getMessage(), "no such table") != -1) {
            // See if the database hasn't been populated.
            // (Note: we use 'while' here rather than 'if' so we can use break
            // to avoid this turning into a mess of nested blocks).
            // First, make sure we have a working database connection.
            try {
                $sth = Dal::query("SHOW TABLES");
            } catch (PAException $e) {
                // The database connection isn't working - so fall through to
                // the normal error handler.
                break;
            }
            // Now run through the results and see if we can find a familiar
            // table.
            $found = 0;
            while ($r = $sth->fetchRow()) {
                if ($r[0] == "page_settings") {
                    $found = 1;
                    break;
                }
            }
            if ($found) {
                // ok, the db *has* been populated - fall through
                break;
            }
            // If we get this far, it means that the DB isn't populated, so we
            // show a message to the user (who is presumably an admin,
            // installing the system).
            global $path_prefix;
            ?>

    <h1>Database not populated</h1>

    <p>Before you can run PeopleAggregator, you need to populate the database by running the script <code><?php 
            echo $path_prefix;
            ?>
/db/PeepAgg.mysql</code> on your database.  You can do it in the MySQL console like this:</p>

    <pre><i>user</i>@<i>server</i>:<?php 
            echo $path_prefix;
            ?>
$ <b>mysql -u <i>username</i> -p</b>
Enter password: <b><i>password</i></b>

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 63048 to server version: 4.1.14-Debian_6-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> <b>use paalpha</b>
Database changed
mysql> <b>source <?php 
            echo $path_prefix;
            ?>
/db/PeepAgg.mysql</b></pre>

      <?php 
            exit;
        }
        // render an error message
        $code_esc = intval($exception->getCode());
        $msg_esc = htmlspecialchars($exception->getMessage());
        $page = new PageRenderer(NULL, NULL, "Error {$code_esc}: {$msg_esc}", "container_one_column.tpl");
        $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/error_middle.tpl");
        $msg_tpl->set('code', $code_esc);
        $msg_tpl->set('msg', $msg_esc);
        $page->add_module("middle", "top", $msg_tpl->fetch());
        $css_path = $current_theme_path . '/layout.css';
        $page->add_header_css($css_path);
        $css_path = $current_theme_path . '/network_skin.css';
        $page->add_header_css($css_path);
        $page->header->set('navigation_links', null);
        //setting the links to null
        echo $page->render();
        // write a copy into the log
        Logger::log("An exception occurred: code " . $exception->getCode() . ", message " . $exception->getMessage() . "\n" . $exception->getTraceAsString(), LOGGER_ERROR);
    } catch (Exception $e) {
        // If an error occurred in PageRenderer or something, present a much plainer screen with both errors:
        echo "<h1>Lots of errors occurred!</h1>\n<p>An error occurred, then the error handler crashed while trying to handle the error.  Whoops!</p>\n<p><b>Here are the details of the original error:</b></p>\n<p>" . $exception->getMessage() . "</p>\n<pre>" . $exception->getTraceAsString() . "</pre>\n<p><b>Here are the details of the second error:</b></p>\n<p>" . $e->getMessage() . "</p>\n<pre>" . $e->getTraceAsString() . "</pre>";
    }
    exit;
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:89,代码来源:html_generate.php


注:本文中的PageRenderer::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。