Notice: We use `Tpl` or `tpl` as the word `Template` in this system!

  • imcat(贴心猫) Tpl-Include --- [Top]
    • ● [Tpl-Include] Used for load public block; Code: {inc:"sub_path/tpl_name"}.
        -> eg: {inc:"d_tpltag/tpltag_aside"}.
        -> Notice: sub_path is the sub dir in the NOW set of tpl, tpl_name is the tpl filename, NOT include the suffix.
        -> Demo: Each page of the last line, you can find like this [tpl:d_tpltag/tpltag_basic;], you can click and view the tpl source code.
    • ● Code-Inclue, Do NOT compile like the tpl:
        -> Demo: {code:"tools/a-cfgs"} -=> inc-file: {NOW-TPL}/tools/a-cfgs.php
        -> Notice: (Dont begain with /, and end with .php)
        -> If some bolck code NOT in the NOT set of tpl, use the flag dir:, eg: {code:"dev:tools/a-cfgs"}
    • ● Cross template-Include: Public-Tpl/Public-Code
        -> Public-Tpl-Include : {inc:"comm:c_pub/inc-blinks"} -=> inc-file: {tpls}/home/c_pub/inc-blinks.htm
        -> Public-Code-Include : {code:"dev:tools/a-cfgs"} -=> inc-file: {tpls}/dev/tools/a-cfgs.php
  • imcat(贴心猫) Tpl-Inherit --- [Top]
    • ● [scene] There are many similar pages, just edit some block(s), it can become another page;
        -> In this case, we can use Tpl-Inherit, we can extract public blocks as [Base-Tpl]
    • ● [Base-Tpl] In these pages, set one or more block, eg: {block:title}layout-title!{/block:title};
        -> Use [Base-Tpl]: eg: {imp:"sub_path/xxx_layout"}, it must at the first line, this page will Inherit the [Base-Tpl] contents
        -> After use [Base-Tpl], the default contetns is the some as [Base-Tpl]
        -> Use like this code: {block:title}my-title!{/block:title} rewrite the block contents
        -> Use {:parent} import the contents from [Base-Tpl], eg: {block:title}my-title!(old:{:parent}){/block:title}
        -> Use {:clear} clear the contents from [Base-Tpl], eg: {block:title}{:clear}{/block:title}
    • ● Notice: Can not be multi-inherit, once inherited the [Base-Tpl], then all the code should be written in the blocks, Otherwise will not display;
    • ● Demo: View Base-Tpl Source-Code or click last line like [tpl:d_tpltag/tpltag_basic;] in each page.
  • imcat(贴心猫) Load-CSS/JS --- [Top]
  • <link href='{=PATH_VIEWS}/dev/assets/home.css' type='text/css' rel='stylesheet'/>
    <script src='{=PATH_VENDUI}/layer/layer.js'></script>
    ------ ------ or
    {php}
    eimp('/~tpl/cinfo.css');      // /views/{tpldir}/assets/cinfo.css
    eimp('/~now/cijs/funcs.js');  // /views/{tpldir}/{mdodir}/cijs/funcs.js
    eimp('/~base/cssjs/cinfo.css'); // /views/base/assets/cssjs/cinfo.css
    eimp('/~base/jslib/jsbase.js'); // /views/base/assets/cssjs/jsbase.js
    eimp('/layer/layer.js','vendui');
    # v4.6
    eimp('/~tpl/cinfo.css'); // /views/{tpldir}/assets/cinfo.css
    eimp('/base/assets/cssjs/cinfo.css'); // /views/base/assets/cssjs/cinfo.css
    eimp('/base/assets/jslib/jsbase.js'); // /views/base/assets/cssjs/jsbase.js
    {php}
    ------ ------ or (Init)
    eimp('initJs','zepto,jquery,bootcss,bootstrap,layer;comm;comm(-lang);user'); // in head
     -=>
        // js-cfgs + /base/assets/jslib/jsbase.js + /base/assets/jslib/jsbext.js
        + 
        <script src='/views/{tpldir}/assets/comm.js'></script>
        <script src='/views/{tpldir}/assets/comm-{lang}.js'></script> // {lang}=cn/en
        <script src='/views/{tpldir}/assets/user.js'></script> // {lang}=cn/en
        + (The above will mergered, And the below will Not mergered) 
        <script src='{=PATH_VENDUI}/jquery/zepto-1x.js'></script> // Just one with jquery
        <script src='{=PATH_VENDUI}/jquery/jquery-3.x.js'></script> // Auto use 1.x/3.x
        <link href='{=PATH_VENDUI}/bootstrap/css/bootstrap.min.css' type='text/css' rel='stylesheet'/>
        <script src='{=PATH_VENDUI}/bootstrap/js/bootstrap.min.js'></script>
        <script src='{=PATH_VENDUI}/layer/layer.js'></script>
    eimp('initCss','bootstrap,stpub,jstyle;comm(-mob);faqs'); // in head
     -=>
        @import url({=PATH_VENDUI}/bootstrap/css/bootstrap.min.css);
        + (The below will mergered, And the above will Not mergered)
        <link href='/base/assets/jslib/stpub.css' type='text/css' rel='stylesheet'/>
        <link href='/base/assets/cssjs/jstyle.css' type='text/css' rel='stylesheet'/>
        <link href='/views/{tpldir}/assets/comm{-mob}.css' type='text/css' rel='stylesheet'/> // Auto use `{-mob}`
        <link href='/views/{tpldir}/assets/faqs.css' type='text/css' rel='stylesheet'/>
    eimp('loadExtjs','jspop,jq_base,bootstrap,layer'); // Can put the end of body
     -=>
        <script src='/views/base/assets/jslib/jspop.js'></script>
        <script src='/views/base/assets/jslib/jq_base.js'></script>
        <script src='{=PATH_VENDUI}/bootstrap/js/bootstrap.min.js'></script>
        <script src='{=PATH_VENDUI}/layer/layer.js'></script>
    ------ ------ or (Else)
    eimp('?ajax-comjs&act=autoJQ');
    basJscss::loadJqbs('zepto',0);
    basJscss::loadJqbs('jquery',0);
    basJscss::loadJqbs('jquery,bootcss,bootstrap,layer',0);
    {/php}
  • imcat(贴心猫) Extra-Libs --- [Top]
    • ● The extra Tpl-Class put in the sub dir: [_funcs];
    • ● _funcs/tex_base.php (this file(calss) will autoload);
    • ● {php vopTpls::tinc('tex_cargo');} // load extra-lib(_funcs/tex_cargo.php) [if needs];
    • ● Demo: file: _funcs/tex_base.php method: function coder($tpl=''), in tpl: c_page/info_coder ues eg: <?php echo tex('texBase')->coder($tpl); ?>;
    • ● Demo: View Now-Tpl Public Class

Notice: These pages at `/dev.php` is the Manual for Imcat, Welcome to `Faqs` Exchange experience!

QQGroup:607070548; Copyright © 2011-2018 txjia.com All rights reserved.

Run:0.000/30.345(ms); 0(sql)/1.968(MB); doc:c_demo/tpltag_main; Upd:2024-04-18 10:45:29