使用TP5.1自定义模板,并继承!

Original 2019-04-22 22:57:09 512
abstract:{// 公用模板} {block name="header"}     {include file="public/header" /} {/block} {block name="content"}    &nb
{// 公用模板}

{block name="header"}
    {include file="public/header" /}
{/block}


{block name="content"}
    内容主体部分
{/block}


{block name="footer"}
    {include file="public/footer" /}
{/block}


{// 先继承父模板}

{extend name="public"}

{//重写主体内容部分}

{block name="content"}

<style type="text/css">
    .content{
        width: 900px;
        height: 500px;
        background: #006666;
        color: black;
        text-align: center;
        margin: auto;
        margin-bottom: 16px;
    }
</style>

    <div class="content">
        <p>这里是内容部分</p>
        <p>我正则学习ThinkPhp的模板继承</p>
    </div>

{/block}

1555944986(1).jpg

Correcting teacher:天蓬老师Correction time:2019-04-23 13:33:57
Teacher's summary:模板继承做为一种代码复用技术, 极大的方便了程序员开发项目, 类似于传统开发中的函数

Release Notes

Popular Entries