Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • General
  • Design & Templates
  •  
  • Pass list to chunk#

  • 38063
    6

    wolfgan Reply #1, 4 months, 2 weeks ago

    Reply
    • Link to this post#1
    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?


  • 38063
    6

    wolfgan Reply #2, 4 months, 2 weeks ago

    Reply
    • Link to this post#2
    I'm yet newb into MODx. Are there MODxable way to build dynamic view for list?


  • 3749
    11,692
    PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!

    MODx info for everyone: http://bobsguides.com/MODx.html

    BobRay Reply #3, 4 months, 2 weeks ago

    Reply
    • Link to this post#3
    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);


  • 38063
    6

    wolfgan Reply #4, 4 months, 2 weeks ago

    Reply
    • Link to this post#4
    Is this example for a Revo? I use an Evo. I have several rows with 'customer_name' and 'customer_phone' in each one.


  • 28042
    15,112
    How MODx Evo Works

    Log in to an Evo Manager username guest, password guestuser.

    sottwell Reply #5, 4 months, 2 weeks ago

    Reply
    • Link to this post#5
    With Evo you can use $modx->parseChunk() in your loop.


    http://wiki.modxcms.com/index.php/API:parseChunk





Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
BobRay, sottwell, wolfgan

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Careers at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy