ecshop show_message 函数解释,元素模板为您解答
文件lib_main.php
show_message(内容, array(返回列表,继续编辑), array(连接地址一,链接地址二, 'info',false);
true:自动跳转
输出:
function show_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true) { assign_template(); $msg['content'] = $content; if (is_array($links) && is_array($hrefs)) { if (!empty($links) && count($links) == count($hrefs)) { foreach ($links as $key => $val) { $msg['url_info'][$val] = $hrefs[$key]; } $msg['back_url'] = $hrefs['0']; } } else { $link = empty($links) ? L('back_up_page') : $links; $href = empty($hrefs) ? 'javascript:history.back()' : $hrefs; $msg['url_info'][$link] = $href; $msg['back_url'] = $href; } $msg['type'] = $type; if (is_null(ECTouch::view()->get_template_vars('helps'))) { ECTouch::view()->assign('helps', model('Article')->get_shop_help()); // 网店帮助 } print_r($msg); ECTouch::view()->assign('title', L('tips_message')); ECTouch::view()->assign('auto_redirect', $auto_redirect); ECTouch::view()->assign('message', $msg); ECTouch::view()->display('message.dwt'); exit; }
php输出
Array ( [content] => 您的收货地址信息已成功更新! [url_info] => Array ( [返回列表] => https://www.ys720.com [继续编辑] => /mobile/index.php?m=default&c=user&a=address_list ) [back_url] => https://www.ys720.com [type] => info )
php代码
public function mg(){ show_message(L('edit_address_success'), array('返回列表','继续编辑'), array('http://www.baidu.com',url('address_list')),'info'); }
html代码
<div class="mg-box"> <div class="ttl"><h3>{$title}</h3></div> <div class="con">{$message.content}</div> <div class="bot"> <ul> <!-- {if $message.url_info} --> <!--{foreach from=$message.url_info key=info item=url}--> <li><a href="{$url}">{$info}</a></li> <!--{/foreach}--> <!--{/if}--> </ul> </div> </div>