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


PHP h2o::render方法代码示例

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


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

示例1: spp_random_terms_func

function spp_random_terms_func($atts)
{
    extract(shortcode_atts(array('count' => 10), $atts));
    global $spp_settings;
    global $wpdb;
    // SELECT * FROM myTable WHERE RAND()<(SELECT ((30/COUNT(*))*10) FROM myTable) ORDER BY RAND() LIMIT 30;
    $sql = "SELECT `term` FROM `" . $wpdb->prefix . "spp` WHERE RAND()<(SELECT ((" . $count . "/COUNT(`term`))*10) FROM `" . $wpdb->prefix . "spp`) ORDER BY RAND() LIMIT " . $count . ";";
    $searchterms = $wpdb->get_results($sql);
    if (!empty($searchterms) && count($searchterms) > 100) {
        $terms = array();
        foreach ($searchterms as $term) {
            $terms[] = $term->term;
        }
    } else {
        $file = @file_get_contents(SPP_PATH . '/keywords.txt');
        if ($file) {
            $terms = explode("\n", $file);
            shuffle($terms);
            $terms = array_slice($terms, 0, $count);
        } else {
            $terms = array();
        }
    }
    $result = new h2o(SPP_PATH . "/templates/widget.html");
    return $result->render(array('terms' => $terms, 'settings' => $spp_settings));
}
开发者ID:gigikiri,项目名称:wpagczone,代码行数:26,代码来源:random-terms.php

示例2: renderEmail

 /**
  * Render template with variables for sending in an email
  *
  * @param $template
  * @param $page
  * @return string
  */
 static function renderEmail($template, $page)
 {
     // H2o object for rendering
     $h2o = new h2o(null, array('autoescape' => false));
     // Load template and render it
     $h2o->loadTemplate(__DIR__ . '/../views/' . $template);
     return $h2o->render(compact('page'));
 }
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:15,代码来源:Notification.php

示例3: renderException

 function renderException($data, $template = "")
 {
     if (DEBUG) {
         $template = "exception.html";
         $template_paths = array(dirname(__FILE__) . '/templates/');
         $h2o = new h2o($template, array('searchpath' => $template_paths, 'cache' => false));
         echo $h2o->render($data);
     } else {
     }
 }
开发者ID:JSilva,项目名称:BareBones,代码行数:10,代码来源:TemplateManager.php

示例4: render

 public function render($template, $vars)
 {
     $registry = Registry::getInstance();
     require_once join_path($registry->web_root, 'system/template/h2o.php');
     $path = join_path($registry->web_root, 'view/' . $template . '.html');
     if (!file_exists($path)) {
         trigger_error('Template: View ' . $path . ' not found!');
     }
     $vars = array_merge($vars, array('config' => $registry));
     $h2o = new h2o($path, array('cache' => 'apc', 'safeClass' => array('V7F\\Helpers\\Registry', 'V7F\\Template\\Template_Helpers')));
     echo $h2o->render($vars);
 }
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:12,代码来源:template.php

示例5: render

 public function render()
 {
     if (!isset($_COOKIE['lang'])) {
         $lang = 'fr';
     } else {
         $lang = $_COOKIE['lang'];
     }
     $h2o = new h2o($this->template, array('searchpath' => 'templates', 'php-i18n' => array('locale' => $lang, 'charset' => 'UTF-8', 'gettext_path' => '/usr/bin/', 'tmp_dir' => '/tmp/')));
     //$session = get_session();
     //$logged = $session->get_logged_user();
     $globals = array('lang' => $lang, 'IMG_URL' => IMG_URL);
     return $h2o->render(array_merge($globals, $this->datas));
 }
开发者ID:jouvent,项目名称:Genitura,代码行数:13,代码来源:response.php

示例6: spp_random_terms_func

function spp_random_terms_func($atts)
{
    extract(shortcode_atts(array('count' => 10), $atts));
    global $spp_settings;
    global $wpdb;
    // SELECT * FROM myTable WHERE RAND()<(SELECT ((30/COUNT(*))*10) FROM myTable) ORDER BY RAND() LIMIT 30;
    $sql = "SELECT `term` FROM `" . $wpdb->prefix . "spp` WHERE RAND()<(SELECT ((" . $count . "/COUNT(`term`))*10) FROM `" . $wpdb->prefix . "spp`) ORDER BY RAND() LIMIT " . $count . ";";
    $searchterms = $wpdb->get_results($sql);
    if (!empty($searchterms)) {
        $result = new h2o(SPP_PATH . "/templates/widget.html");
        return $result->render(array('terms' => $searchterms, 'settings' => $spp_settings));
    } else {
        return false;
    }
}
开发者ID:gigikiri,项目名称:curlwp,代码行数:15,代码来源:random-terms.php

示例7: renderPage

function renderPage($template)
{
    $content = '';
    foreach ($template as $key => $value) {
        // try to mitigate directory traversal and remote inclusion
        if (preg_match('/[^a-zA-Z0-9\\.]/', $template[$key]['name'])) {
            die;
        }
        $_file = TEMPLATES_DIR . str_replace('.', '/', $template[$key]['name']) . '.html';
        // render the content template
        $page = new h2o($_file);
        $content .= $page->render($template[$key]['vars']);
        unset($page);
    }
    // place templates into the context of the main page
    $index = new h2o(TEMPLATES_DIR . 'index.html');
    echo $index->render(array('content' => $content, 'user' => $_SESSION['user']));
    exit;
}
开发者ID:nesicus,项目名称:mephit,代码行数:19,代码来源:site.lib.php

示例8: spp

function spp($term = "", $template = 'default.html', $hack = "")
{
    global $spp_settings;
    $result = new h2o(SPP_PATH . "/templates/{$template}", array('safeClass' => array('SimpleXMLElement', 'stdClass')));
    return $result->render(array('term' => $term, 'hack' => $hack, 'settings' => $spp_settings));
}
开发者ID:gigikiri,项目名称:curlwp,代码行数:6,代码来源:stupidpie.php

示例9: header

require 'h2o/h2o.php';
$h2o = new h2o('templates/friends.html');
$user = $_COOKIE['email'];
$hash = $_COOKIE['crypt'];
if (crypt($user, $hash) == $hash) {
} else {
    header("Location:logout.php");
}
$data = array('error' => '', 'email' => $user);
#$data['email']=$user
require 'config.php';
require 'connect.php';
$ret = mysql_query("SELECT email from incoming where destination='{$user}'");
if (mysql_error($conn)) {
    $data['error'] = mysql_error($conn);
    echo $h2o->render(compact('data'));
    return;
}
while ($row = mysql_fetch_assoc($ret)) {
    $json[] = $row;
}
$ret = mysql_query("SELECT DISTINCT email2 as email from connections where email1='{$user}' and email2<>'{$user}'");
while ($row = mysql_fetch_assoc($ret)) {
    $json1[] = $row;
}
$ret = mysql_query("SELECT email FROM users WHERE email NOT IN ( SELECT email2 FROM connections WHERE email1='{$user}') and email<>'{$user}'") or die(mysql_error());
while ($row = mysql_fetch_assoc($ret)) {
    $json2[] = $row;
}
echo $h2o->render(compact('data', 'json', 'json1', 'json2'));
开发者ID:kharepratyush,项目名称:basic-twitter-prototype,代码行数:30,代码来源:friend.php

示例10: array

<?php

require 'h2o/h2o.php';
$h2o = new h2o('templates/index.html');
$data = array('error' => '');
if (isset($_REQUEST['email'])) {
    require 'config.php';
    require 'connect.php';
    $email = htmlspecialchars($_REQUEST['email']);
    $password = htmlspecialchars($_REQUEST['password']);
    $ret = mysql_query("SELECT password from users where email='{$email}'");
    if (mysql_error($conn)) {
        $data['error'] = mysql_error($conn);
        echo $h2o->render(compact('data'));
        return;
    }
    $crypt = crypt($email);
    while ($row = mysql_fetch_assoc($ret)) {
        if (crypt($password, $row['password']) == $row['password']) {
        } else {
            $data['error'] = "Password Error";
            echo $h2o->render(compact('data'));
            return;
        }
        setcookie("email", $email, time() + 3600, "/");
        setcookie("crypt", $crypt, time() + 3600, "/");
        header("Location:/home.php");
        return;
    }
    $data['error'] = "Not Found : Please Register";
    echo $h2o->render(compact('data'));
开发者ID:kharepratyush,项目名称:basic-twitter-prototype,代码行数:31,代码来源:index.php

示例11: superHandler

/**
 * Handles rendering the header, footer, content and initialising the page
 *
 * @param $parameters
 * @return string
 */
function superHandler($parameters)
{
    // Set our controller and view directories
    $controllerDirectory = __DIR__ . '/../controllers/';
    $viewDirectory = __DIR__ . '/../views/';
    // Initialise our page array
    $page = Session::init($parameters['title'], $parameters['flashes'], $parameters['restricted']);
    // if parameters are passed, then add them
    if (array_key_exists('parameters', $parameters)) {
        $page['parameters'] = $parameters['parameters'];
    }
    // Require our controller
    require $controllerDirectory . $parameters['controller'];
    // Initialise our h2o object
    $h2o = new h2o(null, array('autoescape' => false));
    $output = "";
    if (array_key_exists('header', $parameters) && $parameters['header'] == true) {
        $h2o->loadTemplate($viewDirectory . 'global/header.html');
        $output .= $h2o->render(compact('page'));
    }
    if ($parameters['view'] != null) {
        $h2o->loadTemplate($viewDirectory . $parameters['view']);
        $output .= $h2o->render(compact('page'));
    }
    if (array_key_exists('footer', $parameters) && $parameters['footer'] == true) {
        $h2o->loadTemplate($viewDirectory . 'global/footer.html');
        $output .= $h2o->render(compact('page'));
    }
    // return output
    return $output;
}
开发者ID:Outlaw11A,项目名称:SEP2015,代码行数:37,代码来源:routes.php

示例12: should_be_able_to_output_parent_template_using_blog_super

 public function should_be_able_to_output_parent_template_using_blog_super()
 {
     $h2o = new h2o('home', $this->option);
     expects($h2o->render())->should_be('depth: 2- parent content, depth: 1- child content');
 }
开发者ID:tonjoo,项目名称:tiga-framework,代码行数:5,代码来源:inheritance_spec.php

示例13: array

<?php

include 'init.php';
$h2o = new h2o('templates/b2_filters_tpl.html');
$objects = array();
for ($i = 0; $i < 100; $i++) {
    $o = new stdClass();
    $o->i = $i;
    $o->epoch = (int) time();
    array_push($objects, $o);
}
echo $h2o->render(compact('objects'));
开发者ID:rolando-archive,项目名称:haanga-benchs,代码行数:12,代码来源:b2_1_tpl.php

示例14: contentClass

 *      * Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following disclaimer
 *        in the documentation and/or other materials provided with the
 *        distribution.
 *      * Neither the name of the  nor the names of its
 *        contributors may be used to endorse or promote products derived from
 *        this software without specific prior written permission.
 *      
 *      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *      
 *      
 */
if (!defined('IN_RECOVERY')) {
    die;
}
$content = new contentClass();
$posts = $content->getFrontPage(MAX_NEWS_POSTS, USE_CACHING ? CACHE_DIR : NULL);
$contentTemplate = new h2o(TEMPLATES_DIR . 'post/main.html');
$index = new h2o(TEMPLATES_DIR . 'index.html');
echo $index->render(array('content' => $contentTemplate->render(compact('posts')), 'user' => $_SESSION['user']));
开发者ID:nesicus,项目名称:mephit,代码行数:30,代码来源:main.mod.php

示例15: function

require 'vendor/autoload.php';
/**
 * Let the provisioner automatically intervene and reconfigure Apache. This only
 * happens when users try to access a domain that Apache isn't aware off yet and
 * the provisioner will then - just in time - install vhost files and reload.
 */
\LXC\VirtualHost\ApacheProvisioner::check('root', 'root', 'templates/rebuilding.html', 'templates/vhost.conf');
/**
 * Configure the router.
 */
$router = new \Bramus\Router\Router();
$t = new \h2o();
# ROUTE /: index listing.
$router->get('/', function () use($t) {
    $t->loadTemplate('templates/listing.html');
    print $t->render(array('lxc' => \LXC\Container\Variables::get(), 'vhosts' => \LXC\VirtualHost\Listing::get(), 'hostsoutdated' => \LXC\VirtualHost\Listing::are_hosts_outdated(), 'logfiles' => \LXC\Logging\Files::get(), 'hostname' => gethostname()));
});
# ROUTE /php: PHP information.
$router->get('/php', function () {
    phpinfo();
});
# ROUTE /$LOGFILE: tail -f style log viewer.
foreach (\LXC\Logging\Files::get() as $logfile) {
    $path = '/' . $logfile->name;
    $router->get($path, function () use($t, $logfile) {
        $t->loadTemplate('templates/logtail.html');
        print $t->render(array('file' => $logfile, 'lxc' => \LXC\Container\Variables::get(), 'hostname' => gethostname()));
    });
    $router->get($path . '/(\\d+)', function ($from_line) use($t, $logfile) {
        $logfile->sendPayload((int) $from_line);
    });
开发者ID:nielsvm,项目名称:lxc-containers,代码行数:31,代码来源:index.php


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