温馨提示:本文共3017个字,读完预计8分钟。
函数库路径:web\common\tpl.func.php
eweishopV3插件函数库:addons\ewei_shopv2\core\inc\functions.php
- 音频上传:tpl_form_field_audio($name, $value = '', $options = array())
模板页面引用
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">音乐引用URL</label>
<div class="col-sm-9">
{php echo tpl_form_field_audio('music', $item[‘music’],$this->geturl(4))}
<span class="help-block">为空默认音乐</span>
</div>
</div>
- 视频上传:tpl_form_field_video($name, $value = '', $options = array()) OR tpl_form_field_video2($name, $value = '', $options = array())
模板页面引用
<div class="form-group">
<label class="col-sm-2 control-label">首图视频</label>
<div class="col-sm-9 col-xs-12">
{php echo tpl_form_field_video2('video', $item[‘video’], array('disabled'=>!cv('goods.edit'), 'network'=>true, 'placeholder'=>'请选择视频'))}
<div class='form-control-static'>设置后商品详情首图默认显示视频,目前仅支持小程序</div>
</div>
</div>
- 多图上传:tpl_form_field_multi_image($name, $value = array(), $options = array()) OR tpl_form_field_multi_image2($name, $value = array(), $options = array())
模板页面引用
示例1:
<div class="form-group">
<label class="col-sm-2 control-label">首评回复</label>
<div class="col-sm-9 col-xs-12">
<textarea class="form-control" name="reply_content" rows="3">{$item[‘reply_content’]}</textarea>
</div>
</div><div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-9 col-xs-12">
{php echo tpl_form_field_multi_image2('reply_images',iunserializer($item[‘reply_images’]))}
</div>
</div>示例2:
<div class="form-group">
<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">前台幻灯片</label>
<div class="col-sm-10 col-xs-12">
{php echo tpl_form_field_multi_image('slides', $settings[‘slides’], '', array('global' => true, 'thumb' => 0));}
<span class="help-block">设置首页幻灯片。</span>
</div>
</div>
- 单图上传:tpl_form_field_image2($name, $value = '', $default = '', $options = array()) OR tpl_form_field_image($name, $value = '', $default = '', $options = array())
模板页面引用
示例1:
<div class="form-group">
<label class="col-sm-2 control-label">封面图片</label>
<div class="col-sm-9 col-xs-12">
{ifp 'abonus.cover.edit'}
{php echo tpl_form_field_image2('cover[thumb]’,$cover[‘thumb’])}
{else}
<div class="form-control-static">
<img src="{php echo tomedia($cover[‘thumb’])}" onerror="this.src='./resource/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
</div>
{/if}
</div>
</div>示例2:
<div class="form-group">
<label class="col-sm-2 control-label">收银台背景图</label>
<div class="col-sm-9 col-xs-12">
{php echo tpl_form_field_image('bg',$item[‘bg’],’../addons/ewei_shopv2/plugin/cashier/static/images/bg.jpg’,array(‘dest_dir’=>’cashier/’.$_W[‘cashierid’]))}
<span class="help-block">如果为空,则使用系统默认</span>
</div>
</div>