我已经创建了类似于这个http://rtfm.modx.com/display/ADDON/MIGX.Simple+opening+hours+table的表
我已经成功地将数据导出到资源,但我想以块的形式显示它,以便可以在getresources中显示它。
我使用getresources来显示资源,除了标题和介绍文本之外,我还想显示datesTV数据。
我对migx使用了模板块:
[[+date:notempty=`<td>[[+date:strtotime:date=`%d.%m.%Y, %H.%M`]]</td>`:default=`<td colspan="2">No show!</td>`]]如果我在getresources [+tv.datesTV]的其他块中使用它,我会得到这个数组:
[{"MIGX_id":"1","date":"2012-10-28 21:00:00"},{"MIGX_id":"2","date":"2012-10-28 01:45:00"},{"MIGX_id":"3","date":"2012-10-30 02:45:00"}]如何才能以区块的形式显示这些数据。
发布于 2012-12-19 21:32:11
好了,你可以看看我的代码片段是什么样子的..
<?php
$strJSON = $modx->resource->getTVValue('spored');
$arrJSON = $modx->fromJSON($strJSON);
foreach($arrJSON as $arrJSONDataSet)
{
foreach($arrJSONDataSet as $key => $value)
{
echo $key . ' => ';
echo $value;
echo '<br />';
}
}发布于 2012-11-09 14:06:30
对于MIGX,您需要一个代码片段来解析和格式化存储为JSON的原始电视数据。
有关如何执行此操作的粗略示例,请返回到您提到的链接并尝试getImageList代码片段:http://rtfm.modx.com/display/ADDON/MIGX.Simple+opening+hours+table#MIGX.Simpleopeninghourstable-ParsingtheData
但先看看这是怎么回事……
https://stackoverflow.com/questions/13247317
复制相似问题