layout中main.php全猜测


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

<?php

/* @var $this \yii\web\View */

/* @var $content string */

use backend\assets\AppAsset;

use yii\helpers\Html;

use yii\bootstrap\Nav;

use yii\bootstrap\NavBar;

use yii\widgets\Breadcrumbs;

use common\widgets\Alert;

//注册this

AppAsset::register($this);

?>

//$this->begin/endPage()提供js

<?php $this->beginPage() ?>

<!DOCTYPE html>

<html lang="<?= Yii::$app->language ?>">

<head>

    <meta charset="<?= Yii::$app->charset ?>">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    

    //未知

    <?= Html::csrfMetaTags() ?>

    <title><?= Html::encode($this->title) ?></title>

    

    //$this->begin/endPage() && $this->begin/endBody() && $this->head() 三个标签一起注册CSS

    <?php $this->head() ?>

</head>

<body>

<?php $this->beginBody() ?>

<div>

    <?php

    NavBar::begin([

    

        //文字LOGO区(可无)

        ‘brandLabel‘ => ‘My Company‘,

        ‘brandUrl‘ => Yii::$app->homeUrl,

        

        //导航样式

        ‘options‘ => [

            ‘class‘ => ‘navbar-inverse navbar-fixed-top‘,//导航栏处于"顶部"

        ],

    ]);

    

    $menuItems = [

        [‘label‘ => ‘Home‘‘url‘ => [‘/site/index‘]],

    ];

    

    /*设置导航栏*/

    if (Yii::$app->user->isGuest) {//如果是游客显示请求登录

        $menuItems[] = [‘label‘ => ‘Login‘‘url‘ => [‘/site/login‘]];

    else {

        $menuItems[] = ‘<li>‘

            . Html::beginForm([‘/site/logout‘], ‘post‘)//因为是post方法提交logout所以用form

            . Html::submitButton(

                ‘Logout (‘ . Yii::$app->user->identity->username . ‘)‘,//按钮文字

                [‘class‘ => ‘btn btn-link‘]//按钮样式,可以换成其他样式,比如btn btn-danger显示"危险"按钮,网上有bootstrap教程

            )

            . Html::endForm()

            ‘</li>‘;

    }

    

    /*设置完毕,显示导航栏*/

    echo Nav::widget([

        ‘options‘ => [‘class‘ => ‘navbar-nav navbar-right‘],//导航栏样式,靠左?靠右

        ‘items‘ => $menuItems,

    ]);

    NavBar::end();

    ?>

    <div>

        //"当前位置"导航

        <?= Breadcrumbs::widget([

            ‘links‘ => isset($this->params[‘breadcrumbs‘]) ? $this->params[‘breadcrumbs‘] : [],

        ]) ?>

        

        //未知作用

        <?= Alert::widget() ?>

        

        //view层替换的是content

        <?= $content ?>

    </div>

</div>

<footer>

    <div>

        <p>&copy; My Company <?= date(‘Y‘) ?></p>

        <p><?= Yii::powered() ?></p>

    </div>

</footer>

<?php $this->endBody() ?>

</body>

</html>

<?php $this->endPage() ?>

时间: 2024-08-12 02:57:12

layout中main.php全猜测的相关文章

Log中&#39;main&#39;, &#39;system&#39;, &#39;radio&#39;, &#39;events&#39;以及android log分析

在Android中不同的log写到不同的设备中,共有/dev/log/system, /dev/log/main, /dev/log/radion, /dev/log/events四中类型.其中默认Log.v等写入/dev/log/main中.Slog写入/dev/log/system中. 我们在使用logcat 抓去日至的时候, 可以指定buffer,来请求不同的环形缓冲区 ('main', 'system', 'radio', 'events',默认为"-b main -b system&q

Angularjs中UI Router全攻略

摘自:Angularjs中UI Router全攻略 温馨提示:想要了解 angular-ui-router的同学,从上往下读一遍,能带随着coding那就更好了,保证你对angular-ui-router基本全部掌握. 如何引用依赖angular-ui-router angular.module('app',["ui.router"]) .config(function($stateProvider){ $stateProvider.state(stateName, stateCofi

android布局layout中的一些属性

1.可以使某些资源文件或UI组件可重用 <include layout="@layout/other"/> 2.定义一个文本编辑框,使用绝对定位 android:layout_x="20dip" android:layout_y="80dip" 3.控件位置 android:layout_centerHorizontal 控制该组件是否位于布局容器的水平居中位置 android:layout_centerVertical 控制该组件是

假设用一个名为text的字符串向量存放文本文件的数据,其中的元素或者是一句话或者是一个用于表示段分隔的空字符串。将text中第一段全改为大写形式

#include<iostream> #include<string> #include<vector> using namespace std; int main() { vector<string> str={"The is C++ program ","hfh ","","hfdshfisoid"}; for(auto it=str.begin();it!=str.end(

java 判断一个字串中的字符全是字母

记录一个方法,用来判断一个字串中字符是否全为字母 public class MainClass { public static void main(String[] args){ String str = "hhhggdxszfff"; boolean is_boolean = isPhonticName(str); System.out.println(is_boolean); } public static boolean isPhonticName(String str) { c

在C++工程中main函数之前跑代码的廉价方法(使用全局变量和全局函数)

[cpp] view plain copy // test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #include <crtdbg.h> /// 在C++工程中main函数之前跑代码的廉价方法 /// 利用全局变量可以赋可变初值的事实 /// mainCRTStartup() => _cin

WebView中的视频全屏的相关操作

最近工作中,基本一直在用WebView,今天就把它整理下: WebView 顾名思义,就是放一个网页,一个看起来十分简单,但是用起来不是那么简单的控件. 首先你肯定要定义,初始化一个webview,其实网上的例子很多,我这里就简单的把一些WebView 中可能会用到的的很重要的属性以及支持全屏播放视频该怎么实现的代码粘出来,直接放到项目中去就行了 <span style="white-space:pre"></span><pre name="co

Matlab中plot函数全功能解析

Matlab中plot函数全功能解析 功能 二维曲线绘图 语法 plot(Y)plot(X1,Y1,...)plot(X1,Y1,LineSpec,...)plot(...,'PropertyName',PropertyValue,...)plot(axes_handle,...)h = plot(...)hlines = plot('v6',...) 描述 plot(Y)如果Y是m×n的数组,以1:m为X横坐标,Y中的每一列元素为Y坐标,绘制n条曲线:如果Y是n×1或者1×n的向量,则以1:n

AppBox中main树节点单击事件JS(还有叶子的节点的页面链接)

AppBox中main.aspx.csif (menu.IsTreeLeaf) {                        node.Leaf = true;                    }                    else                    {                        node.SingleClickExpand = true;                    }---如果node.SingleClickExpand