• imcat(贴心猫) English-Tpl --- [Top]
    • ● Target :
        -> Suppose : These model have exists(enabt:Introduce; enews:Dynamic)
        -> Reference : Develop >> 2nd-Dev:Suit-Demo
        -> Add a set of Tpl, Use English show the Info(Introduce/Dynamic)
    • ● Add Tpl dir:
        -> Add dir ven: /views/ven
        -> Add sub dir: _config(Tpl Configs), _ctrls(Tpl Extra Class)
        -> Other sub dir reference existing template, self planning
        -> Add img/js/css dir:
        -> Add sub dir: b_img(Image,Icon), assets(js/css)
    • ● Add Entry:
        -> Dir: \root\run\
        -> Copy: eng.php to english.php, or use file eng.php direct.
        -> Edit: $_cbase['tpl']['vdir'] = 'ven';
        -> Edit: $_cbase['sys']['lang'] = 'en'; // Set Language
        -> The param ven is the tpl dir
    • ● Add Config:
        -> File : /root/cfgs/sycfg/sy_vopcfg.php
        -> Add an item in $_sy_vopcfg['tpl'], 'ven' => array('English','/english.php'),
        -> View Url : /english.php, Enjoy!
    • ● Reference Tips:
        -> Copy a set of Tpl to modify : eg:home(中文版)
        -> Reference dir: /views/ >> dev, home, adm
  • imcat(贴心猫) Model-Config --- [Top]
    • ● Copy homepage Config:
        -> va_home.php, from: /views/home/_config to: /views/ven/_config
    • ● Copy about Config:
        -> vc_about.php, from: /views/home/_config to: /views/ven/_config
        -> Modiy the filename as: vc_enabt.php, (enabt is the model ID)
    • ● Copy news Config:
        -> vc_news.php, from: /views/home/_config to: /views/ven/_config
        -> Modiy the filename as: vc_enews.php, (enews is the model ID)
    • ● Tpl/Resources:
        -> Copy the tpls/resources, from: /views/home/ to: /views/ven/
        -> If you need, Modiy the configs,tpls,resources...
  • imcat(贴心猫) Config-Speci. --- [Top]
    • va_home: homepage config
        -> c: basic config
        -> m: model homepage config
        -> u: (custom) config see: /views/umc/_config/va_home.php

    • ● vc_model: system model
        -> model is the model ID, one model a file
    • ● ve_extra: extra model
        -> extra is the model ID, one model a file
  • imcat(贴心猫) Suit-Tools --- [Top]
    • ● Purpose: create a set of Tpl(Diy)
    • ● Notice:
        -> Diy Url: {proj}/root/tools/exdiy/mktpl.php, for the safe, It ONLY opend in localhost url
        -> In default, Only show one model[Docs/News] and an hellow extra-page
        -> To rich template, show more model info, you will DIY...
    • ● Idea from:
        -> In Symfony, Use app/console generate:bundle to create Bundles;
        -> Why is it so high with the command, Why not use a PHP page to realize it?
        -> In this system, I Imitate Symfony create Bundles, set some params in the web UI, create a set of Tpl
        -> In this system, Named as [Suit Tpl Tools], If you get the more suitable name, please share it.
  • imcat(贴心猫) Notice(bug) --- [Top]
    • This is a bug in the Tpl(while Tpl Compiled):
        -> These 2 problems as below, I want`nt to solve it while compile tpl(Multiple replacement/替换来替换去)
        -> Please expression a methed to avoid them(In fact, It is very easy to avoid this)

    • ● [1] Use curly braces({}) show variables in the HTML remark:
    // eg: <!--{=$this->tplname}-->
    // -=>Parse into: <?php echo @$this->tplname; ?>
    // -=>It should: <!--<?php echo @$this->tplname; ?>-->
    // Solve: Add special symbol like as `/`: <!--/{=$this->tplname}/-->  
    // or Remark(<i id="jsid_count_{=$pmod}:{=$did}">0<!--`{=$this->mod},cnt_{=$pmod}`--></i>) (Use ` split them)
    • ● [2] The variables in the double quotation marks(""):
        -> While these code in the tpl pages, It will conflict
    // !!! This problem has been resolved in v3.9, old is:{$vname} -=> new is:{=$vname}
    eg: {php echo "userip={$_cbase['run']['userip']};"; }
    // -=>Parse into: <?php echo "userip=<?php echo @$_cbase['run']['userip']; ?>;"; ?>
    // -=>It should: <?php echo "userip=".@$_cbase['run']['userip'].";"; ?>
    Solve1: Use `.` contact the string: {php echo "userip=".@$_cbase['run']['userip'].";"; }
    Solve2: For large block PHP code, do not need template parsing, can be used as follows:
    {php include_once vopTpls::tinc('m_tppart/tpfile',0); } 
    or: {code:"dev:tools/a-cfgs"}
    -=> include file (it will NOT parse the code)
    {NOW-Tpl-Dir}/m_tppart/tpfile.php 
  • imcat(贴心猫) Multi-Language --- [Top]
    • ● How to config:
        -> Config dir: /imcat/lang/,
        -> Store sub dirs by category, a language pack each a file in a dir
        -> Set Entry file: $_cbase['sys']['lang'] = 'en'; // Multi-Language
    • ● How to use
        * php
         - basLang::show('core.page_First')
         - lang('admin.adm_center') 
         - <?php lang('tools.start_setup',0) ?>
        * tpl
         - {lang(core.view_times,$click)} 
         - {lang(core.sys_name)}
        * js
         - lang('jcore.sub_key')

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/34.785(ms); 0(sql)/1.968(MB); doc:c_demo/tpltag_main; Upd:2024-04-24 04:09:14