I'm building a snippet that returns data as a list. I want to separate a view and a business logic. How to pass output from the snippet to a chunk and display its with <li> tags?
I'm yet newb into MODx. Are there MODxable way to build dynamic view for list?
Put placeholder tags in the chunk:
<ul>
<li>Name: [[+customer_name]]</li>
<li>Phone: [[+customer_phone]]</li>
</ul>
Then in the snippet:
<?php
$fields = array();
$fields['customer_name'] = 'bob';
$fields['customer_phone'] = '555-1234';
return $modx->getChunk('MyChunk', $fields);
Is this example for a Revo? I use an Evo. I have several rows with 'customer_name' and 'customer_phone' in each one.
-
☆ A M B ☆
- 24,524 Posts
With Evo you can use $modx->parseChunk() in your loop.
http://wiki.modxcms.com/index.php/API:parseChunk