The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/showthread.php 26 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1952 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1952 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 629 mark_thread_read
Warning [2] Undefined property: MyLanguage::$ratings_update_error - Line: 5 - File: showthread.php(732) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(732) : eval()'d code 5 errorHandler->error
/showthread.php 732 eval
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "invisible" - Line: 1506 - File: showthread.php PHP 8.1.27 (Linux)
File Line Function
/showthread.php 1506 errorHandler->error
Warning [2] Undefined variable $threadnotesbox - Line: 30 - File: showthread.php(1533) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 30 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $addremovesubscription - Line: 79 - File: showthread.php(1533) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 79 errorHandler->error
/showthread.php 1533 eval



FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
XML Export - Templating Smarty Question
#1
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:

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.
Reply
#2
Hi Waizen,

No worries, you were almost there. Just move the opening & closing <request_merchant_account> node to inside the first loop. That will then be outputted for every submission:

Code:
<mw>
    {foreach from=$submissions item=submission name=row}
    <request_merchant_account>
     {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}
    </request_merchant_account>
    {/foreach}
</mw>

I confess I haven't checked it, but that should work fine.

Let me know if you have any trouble!

- Ben
Reply
#3
It worked perfect, Ben! Thank you!

...however...

The client now has a new request, which I have a feeling Form Tools may not be able to help, but here goes anyway:

It seems that the client now needs to have form data get converted to XML, in the exact format above, but then get passed immediately and directly to a remote server (FTP address, with login requirements) in XML form. One XML record per form entry. In other words, one XML file per every form entry site visitors fill out. Hope I made sense.

Would that be asking too much of your incredible application? (big fan, here, by the way)

If not, any other suggestions? Thank you so much for your help.
Reply
#4
Hi Waizen,

Thanks! Interesting problem... but the short answer is no, as you expected. Sad

For that, you'd need some additional code. You could certainly extend the Core with a module to allow for it, but it would take some custom work.

Just out of curiosity, do they want the XML files to be submitted via FTP after every submission, or just every once in a while (e.g. when the administrator requests it)? If the latter, presumably you'd want an "Export via FTP" button/page?

- Ben
Reply
#5
(Nov 22nd, 2011, 10:28 PM)Ben Wrote: Hi Waizen,

Thanks! Interesting problem... but the short answer is no, as you expected. Sad

For that, you'd need some additional code. You could certainly extend the Core with a module to allow for it, but it would take some custom work.

Just out of curiosity, do they want the XML files to be submitted via FTP after every submission, or just every once in a while (e.g. when the administrator requests it)? If the latter, presumably you'd want an "Export via FTP" button/page?

- Ben

Hi, Ben. Thank you for your response.

Believe it or not, my client now finds out that he is to send XML forms of visitors submitting information to a third party but needs to have each submission go through as its own record (XML file). The files need to go up to an FTP site, through login procedures. The third party is not a technical type person and has no idea how other clients of his does the same thing, nor does he have a dedicated technical person to answer my questions.

So, to my client's benefit, I set him up with Form Tools so that he could have his own database of form submissions, as well.

Unfortunately, this means that my client is going to have to download the XML file off the server with multiple records and copy/paste each submission, in the proper format, into separate files and submit each separately. Really not a big deal when done a couple of times but I'm thinking that's not something he should need to do.

Since I'm not a php guru, I have been spending way too much time doing R&D to try to come up with a solution. Internet searches have resulted in very limited successes.

Anyway, thank you for your help and for your incredible application. I'm a big fan of it.

BTW: why am I not seeing a PayPal contribution button on your site somewhere? Weren't you going to take contributions at some point? Am I missing it in plain sight?
Reply
#6
Hi Waizen,

Yeesh, separate FTP uploads per submission is quite the process...! I think you'd really need a custom module written to do it properly, though - so that the code is attached to the appropriate hook & executed when the submission is first put through. (What about updates made within Form Tools? Are they re-FTPd over?).

And regarding donations, we're actually slowly moving to selling premium modules! Once the first one was out, I removed the donation link. We've only a few out now, like the Data Visualization and Report Builder modules, but it's a start!

All the best -

Ben
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)