Nov 21st, 2011, 9:33 AM
Hi, I'm new to smarty templating, so please bear with me.
I have a form that needs to collect info then report each entry in XML form. According to requirements, the report should follow this format:
I accomplished this successfully by modifying my smarty template to look like this:
All of that would be great if I only had one form submission, but with multiple submission, such as the two submissions illustrated below, the XML report looks like this:
As you can imagine, I would need the reporting to come out looking like this:
I assume that the modifications required would need to take place within the smarty template? If so, exactly what template code would I need to accomplish that?
Thank you in advance.
I have a form that needs to collect info then report each entry in XML form. According to requirements, the report should follow this format:
Code:
<mw>
<request_merchant_account>
<accept_cc>(yes or no radio button answer)</accept_cc>
<contact_name>John Doe</contact_name>
<business_name>Acme, Inc.</business_name>
<contact_phone>800-555-1234</contact_phone>
<contact_email>info@domain.com</contact_email>
<zip_code>xxxxx</zip_code>
</request_merchant_account>
</mw>
I accomplished this successfully by modifying my smarty template to look like this:
Code:
<mw>
<request_merchant_account>
{foreach from=$submissions item=submission name=row}
{foreach from=$display_fields item=field_info name=col_row}
{assign var=col_name value=$field_info.col_name}
{assign var=value value=$submission.$col_name}
<{$col_name}>{smart_display_field form_id=$form_id
view_id=$view_id submission_id=$submission.submission_id
field_info=$field_info field_types=$field_types
settings=$settings value=$value}</{$col_name}>
{/foreach}
{/foreach}
</request_merchant_account>
</mw>
All of that would be great if I only had one form submission, but with multiple submission, such as the two submissions illustrated below, the XML report looks like this:
Code:
<mw>
<request_merchant_account>
<accept_cc>(yes or no radio button answer)</accept_cc>
<contact_name>John Doe</contact_name>
<business_name>Acme, Inc.</business_name>
<contact_phone>800-555-1234</contact_phone>
<contact_email>info@domain.com</contact_email>
<zip_code>xxxxx</zip_code>
<accept_cc>(another yes or no radio button answer)</accept_cc>
<contact_name>Bill Smith</contact_name>
<business_name>Phonyco, Inc.</business_name>
<contact_phone>800-555-5678</contact_phone>
<contact_email>info@helloworld.com</contact_email>
<zip_code>yyyyy</zip_code>
</request_merchant_account>
</mw>
As you can imagine, I would need the reporting to come out looking like this:
Code:
<mw>
<request_merchant_account>
<accept_cc>(yes or no radio button answer)</accept_cc>
<contact_name>John Doe</contact_name>
<business_name>Acme, Inc.</business_name>
<contact_phone>800-555-1234</contact_phone>
<contact_email>info@domain.com</contact_email>
<zip_code>xxxxx</zip_code>
</request_merchant_account>
<request_merchant_account>
<accept_cc>(another yes or no radio button answer)</accept_cc>
<contact_name>Bill Smith</contact_name>
<business_name>Phonyco, Inc.</business_name>
<contact_phone>800-555-5678</contact_phone>
<contact_email>info@helloworld.com</contact_email>
<zip_code>yyyyy</zip_code>
</request_merchant_account>
</mw>
I assume that the modifications required would need to take place within the smarty template? If so, exactly what template code would I need to accomplish that?
Thank you in advance.