:::
XOOPS模組開發

用模組製造機製作的區塊,內容 只顯示 Array,無法顯示我要出現的「新進資料」?

discuss pic 2017-01-12 15:36:35
Tad 老師 您好!
請教一下...我用模組製造機編寫一區塊,顯示 「新進資料」,如下..

 //區塊主函式 (ben_property_list)
function ben_property_list($options){
  
  global $xoopsDB;

  //{$options[0]} : 列出資料數
  $block['options0']=$options[0];
  $sql="select `pp_sn`, `pp_title` from `".$xoopsDB->prefix("ben_property")."` where `pp_enable` = '1' order by `pp_keyindate` desc limit 0, {$options[0]}";
  $result = $xoopsDB->query($sql) or web_error($sql);
  
  $content='';
  $i=0;

  while($all = $xoopsDB->fetchArray($result)){
    $content[$i]=$all;
    $i++;
  }
  $block['content']=$content;

  return $block;
}

我有檢查 xoops_version.php 的區塊內對應的相關檔案
樣版檔 內 有編寫 <{$block}>
也開除錯亦都無誤,

可是區塊內容 都只顯示 Array,無法顯示我要出現的「新進資料」,

所以想請您協助看一下...是那裡出錯,
以上請您參考指教,Thanks.
discuss pic 2017-01-17 23:13:37
tad
區塊樣板是錯的,改寫成這樣試試:
<{foreach from=$block.content item=data}>
    <li><{$data.
pp_title}></li>
<{/foreach}>

discuss pic 2017-01-19 11:51:21
OK 了,感謝您!
:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_discuss%2Fdiscuss.php%3FDiscussID%3D33407%26BoardID%3D19

線上使用者

39人線上 (15人在瀏覽討論留言)

會員: 0

訪客: 39

更多…