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


PHP Q_Response::layoutView方法代码示例

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


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

示例1: layoutView

 /**
  * Get or set the layout view that should be used in the response
  * @method layoutView
  * @static
  * @param {string} $newView optionally set the new view, or unset it by passing false
  * @return {string}
  */
 static function layoutView($newView = null)
 {
     if (isset($newView)) {
         return Q_Response::$layoutView = $newView;
     }
     if (Q_Response::$layoutView) {
         return Q_Response::$layoutView;
     }
     $app = Q_Config::expect('Q', 'app');
     $layout_view = Q_Config::get('Q', 'response', 'layout', 'html', "{$app}/layout/html.php");
     $desktop_layout_view = Q_Config::get('Q', 'response', 'layout', 'desktop', false);
     if ($desktop_layout_view) {
         $layout_view = $desktop_layout_view;
     }
     if (Q_Request::isTablet()) {
         $tablet_layout_view = Q_Config::get('Q', 'response', 'layout', 'tablet', false);
         if ($tablet_layout_view) {
             $layout_view = $tablet_layout_view;
         }
     } else {
         if (Q_Request::isMobile()) {
             $mobile_layout_view = Q_Config::get('Q', 'response', 'layout', 'mobile', false);
             if ($mobile_layout_view) {
                 $layout_view = $mobile_layout_view;
             }
         }
     }
     return $layout_view;
 }
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:36,代码来源:Response.php

示例2: Q_response


//.........这里部分代码省略.........
                            if ($temp) {
                                $to_encode['scriptData'][$slotName] = $temp;
                            }
                            $temp = Q_Response::templateData($slotName);
                            if ($temp) {
                                $to_encode['templates'][$slotName] = $temp;
                            }
                        }
                    } else {
                        $to_encode['slots'] = Q_Response::slots(true);
                        // add stylesinline, scriptlines, scriptdata, templates
                        foreach (array_merge(array(''), $slotNames) as $slotName) {
                            $temp = Q_Response::stylesInline($slotName);
                            if ($temp) {
                                $to_encode['stylesInline'][$slotName] = $temp;
                            }
                            $temp = Q_Response::scriptData($slotName);
                            if ($temp) {
                                $to_encode['scriptData'][$slotName] = $temp;
                            }
                            $temp = Q_Response::scriptLines($slotName, true, "\n", false);
                            if ($temp) {
                                $to_encode['scriptLines'][$slotName] = $temp;
                            }
                        }
                    }
                }
            }
        }
        $to_encode['timestamp'] = microtime(true);
        $echo = Q_Request::contentToEcho();
        if (isset($echo)) {
            $to_encode['echo'] = $echo;
        }
        $json = Q::json_encode(Q::cutoff($to_encode));
        $callback = Q_Request::callback();
        switch (strtolower($isAjax)) {
            case 'iframe':
                if (!Q_Response::$batch) {
                    header("Content-type: text/html");
                }
                echo <<<EOT
<!doctype html><html lang=en>
<head><meta charset=utf-8><title>Q Result</title></head>
<body>
<script type="text/javascript">
window.result = function () { return {$json} };
</script>
</body>
</html>
EOT;
                break;
            case 'json':
            default:
                if (!Q_Response::$batch) {
                    header("Content-type: " . ($callback ? "application/javascript" : "application/json"));
                }
                echo $callback ? "{$callback}({$json})" : $json;
        }
        return;
    }
    // If this is a request for a regular webpage,
    // fill the usual slots and render a layout.
    if (Q_Response::$redirected) {
        return;
        // If already set a redirect header, simply return -- no reason to output all this HTML
    }
    static $added_Q_init = false;
    if (!$added_Q_init) {
        Q_Response::addScriptLine("\n// Now, initialize Q\nQ.init();\n", null, 'Q');
        $added_Q_init = true;
    }
    // Get all the usual slots for a webpage
    $slots = array();
    foreach ($slotNames as $sn) {
        Q_Response::fillSlot($sn, 'default', Q::ifset($idPrefixes, $sn, null));
    }
    // Go through the slots again, because other handlers may have overwritten
    // their contents using Q_Response::setSlot()
    foreach ($slotNames as $sn) {
        Q_Response::fillSlot($sn, 'default', Q::ifset($idPrefixes, $sn, null));
    }
    $output = Q_Response::output();
    if (isset($output)) {
        if ($output === true) {
            return;
        }
        if (is_string($output)) {
            echo $output;
        }
        return;
    }
    if (!$isAjax or Q_Request::isLoadExtras()) {
        Q::event('Q/responseExtras', array(), 'after');
    }
    $slots = Q_Response::slots(false);
    // Render a full HTML layout
    $layout_view = Q_Response::layoutView();
    echo Q::view($layout_view, $slots);
}
开发者ID:atirjavid,项目名称:Platform,代码行数:101,代码来源:response.php


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