github.com/keysonZZZ/kmg@v0.0.0-20151121023212-05317bfd7d39/kmgView/kmgGoTpl/testFile/test1.gotplhtml (about) 1 <? 2 package example 3 4 type Input struct{ 5 Name string 6 Value string 7 ShowName string 8 Comment string 9 Need bool 10 ReadOnly bool 11 Id string 12 } 13 func tplInputString(config Input)string{ 14 ?> 15 <div class="form-group has-feedback"> 16 <label class="col-sm-2 control-label"><?=config.ShowName?> 17 <? if config.Need{ ?> 18 <span style="color:red">*</span> 19 <? } ?> 20 21 <div class="col-sm-8"> 22 <input type="text" autocomplete="off" class="form-control" 23 <? if config.ReadOnly{ ?>readonly<? } ?> 24 name="<?=config.Name?>" 25 value="<?=config.Value?>"/> 26 <span style="font-size:12px;color:red"> 27 <? if config.Comment!=""{ ?> 28 提示: <?=config.Comment?> 29 <? } ?> 30 </span> 31 </div> 32 </div> 33 <? } 34 ?>