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


PHP ViewFactory::make_view方法代码示例

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


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

示例1: get_view

 function get_view($template)
 {
     return ViewFactory::make_view(strtolower($template));
 }
开发者ID:brysonian,项目名称:Saint,代码行数:4,代码来源:AbstractController.php

示例2: render_partial

function render_partial($action, $object = false, $collect = false, $controller = false)
{
    #if the controller is an array, use it and ignore the rest
    if (is_array($action)) {
        if (array_key_exists('object', $action)) {
            $object = $action['object'];
        }
        if (array_key_exists('collect', $action)) {
            $collect = $action['collect'];
        }
        if (array_key_exists('controller', $action)) {
            $controller = $action['controller'];
        }
        if (array_key_exists('action', $action)) {
            $action = $action['action'];
        }
    } else {
        if ($controller == false) {
            $controller = params('controller');
        }
    }
    # set the template and object name
    $slashloc = strrpos($action, '/');
    if ($slashloc !== false) {
        $objectname = substr($action, $slashloc + 1);
        if ($action[0] == '/') {
            $template = substr(substr($action, 0, $slashloc) . '/_' . $objectname, 1);
        } else {
            $template = url_name($controller) . '/' . substr($action, 0, $slashloc) . '/_' . $objectname;
        }
    } else {
        $template = url_name($controller) . '/_' . $action;
        $objectname = $action;
    }
    $view = ViewFactory::make_view($template);
    # include the helpers
    if (file_exists(PROJECT_ROOT . '/app/helpers/app.php')) {
        include_once PROJECT_ROOT . '/app/helpers/app.php';
    }
    if (file_exists(PROJECT_ROOT . '/app/helpers/' . $controller . '.php')) {
        include_once PROJECT_ROOT . '/app/helpers/' . $controller . '.php';
    }
    # if it's a collection, call it for each item in the obj
    $objectname = var_name(class_name($objectname));
    if ($collect === true) {
        foreach ($object as $k => $v) {
            echo $view->parse_partial($objectname, $v);
        }
    } else {
        echo $view->parse_partial($objectname, $object);
    }
}
开发者ID:brysonian,项目名称:Saint,代码行数:52,代码来源:AbstractView.php


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