第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

smarty怎么傳值?

smarty怎么傳值?

錯過了年華 2017-06-25 22:54:34
下面是我現(xiàn)在的代碼:index.tpl{section?name=arr?loop=$rst?max=2?start=0} ?????????? ???????????{if?$smarty.section.arr.index<2?} ???????????{*?<?php?for($i=0;$i<2;$i++){ ???????$row=mysql_fetch_array($_result); ???????list(??$year,$month?,??$day??)?=?preg_split??(?'[/.-]'?,?$news_date?);*} ???{*注釋是原來的php代碼*} ??? ? ????????????<div?class="n1"> ????????????????<div?class="top_lefr"> ????????????????????<div?class="day">{$day}</div> ????????????????????<div?class="year_month">{$year}{$month}</div> ????????????????</div> ????????????????<div?class="top_right"><a?href="new_con.php?&id={$rst[arr].news_id}&ntr={$rst[arr].news_type}?"?title="{$rst[arr].news_title|truncate:"32":"...":"true"}">{$rst[arr].news_title|truncate:"32":"...":"true"}</a></div> ????????????????<div?class="img"><a?href="new_con.php?&id=?{$rst[arr].news_id}?&ntr={$rst[arr].news_type}?"><img?src="{$rst[arr].news_img}"?width="1920"?height="1200"?/></a></div> ????????????</div> ???????????? ??????????? ???????????{/if}? ?????? {/section} ????????????{*?<?php?}?>?*}index.php<?php require_once('include.php'); $sql="select?*?from?tb_news?where?news_type='4'?order?by?news_date?DESC"; ? $rst?=?$admindb->ExecSQL($sql,$conn); $rst_news_img=$rst[0]["news_img"]; for($i=0;$i<2;$i++){ $news_date=$rst[$i]["news_date"]; } list(??$year,?$month,?$day??)?=?preg_split??(?'[/.-]'?,?$news_date?); //$htgl=$_GET["htgl"]; $smarty->assign('rst',$rst); $smarty->assign('rst_news_img',$rst_news_img); $smarty->assign('year',$year); $smarty->assign('month',$month); $smarty->assign('day',$day); $smarty->display('index.tpl'); ?>像我這樣做只能傳固定的三個值($year, $month, $day?),由于不能把邏輯控制部分放在tpl,但是不放在那里循環(huán),得到的又只能是固定的值,根本不能對應起來。怎么才能傳對應的值?
查看完整描述

2 回答

?
錯過了年華

TA貢獻56條經(jīng)驗 獲得超22個贊

或者說smarty分割字符串的函數(shù)是什么?
查看完整回答
反對 回復 2017-06-26
  • 2 回答
  • 0 關注
  • 2338 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號