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
Cannot view image in html export
#1
I can view the lightbox image when I edit the submission and click on the file name, however I can only view the file name when exporting html.

also a related subject:
I very much need to know where to edit the format of the html export page. I have looked in the module- Export Manager and found this line commented in the start of the php:

"It calls the export.tpl found in the /modules/export_manager/templates folder."

However I found no such file: export.tpl

I have also looked for a way to do this using the api, however that documentation is apparently incomplete:

http://modules.formtools.org/export_mana...nced_usage

I hope you are not to busy to assist. You were very helpful before...
Reply
#2
Quote:I can view the lightbox image when I edit the submission and click on the file name, however I can only view the file name when exporting html.

Yes, by default, the HTML / Printer-friendly content (defined by the Export Manager) just links to the files - not embeds them in the page. But it's not too tricky to tweak - everything in the HTML generated pages can be edited so you can make them look however you want.

Just so we're on the same page: the Export Manager handles the actual HTML generation. So to edit it, go to Modules -> Export Manager -> select the HTML / Printer-friendly format -> click on the "Export Types" tab. Here, it lists the three Smarty templates which are used to generate the three.

That's the bit you'll need to edit.

Here's a quick example. I've modified the "Table format" export type to handle displaying files a little differently. Specifically, it assumes that all file fields are IMAGE fields (if this isn't the case for all your forms, let me know and I'll explain how to tweak it to only display the image for specific file fields).

Code:
<h1>{$form_name}</h1>

<table cellpadding="2" cellspacing="0" width="100%" class="print_table">
{* display the column headings *}
<tr>
  {foreach from=$display_fields item=column name=row}
    <th>{$column.field_title}</th>
  {/foreach}
</tr>

{* loop through all submissions in this current result set, and display each item in a manner
   appropriate to the field type *}
{foreach from=$submissions item=submission name=row}
  <tr>
    {foreach from=$display_fields item=field name=col_row}
      {assign var=field_id value=$field.field_id}
      {assign var=field_type value=$field.field_info.field_type}
      {assign var=col_name value=$field.col_name}
      {assign var=value value=$submission.$col_name}

      <td>
        {if $field_type == "select" || $field_type == "radio-buttons"}
          {smart_display_field_values field_id=$field_id selected=$value}
        {elseif $field_type == "checkboxes" || $field_type == "multi-select"}
          {smart_display_field_values field_id=$field_id selected=$value multiple=true}
        {elseif $field_type == "file"}      
          <img src="{$field.field_info.settings.file_upload_url}/{$value}" />        
        {elseif $field_type == "system"}
          {if $col_name == "submission_id"}
            {$submission.submission_id}
          {elseif $col_name == "submission_date"}
            {$submission.submission_date|custom_format_date:$timezone_offset:$date_format}
          {elseif $col_name == "last_modified_date"}
            {$submission.last_modified_date|custom_format_date:$timezone_offset:$date_format}
          {elseif $col_name == "ip_address"}
            {$submission.ip_address}
          {/if}
        {else}
          {$value}
        {/if}
      </td>

    {/foreach}
  </tr>
{/foreach}
</table>


The new lines that I added are:


Code:
{elseif $field_type == "file"}      
          <img src="{$field.field_info.settings.file_upload_url}/{$value}" />

Does this help at all? Let me know if you need help tweaking the other templates or anything else. I confess that this functionality IS more heavily geared towards programmers than end-users, unlike other aspects of the software. But ultimately I thought it was important to provide as much functionality as possible, hence the added complexity.

Quote:I very much need to know where to edit the format of the html export page. I have looked in the module- Export Manager and found this line commented in the start of the php:

"It calls the export.tpl found in the /modules/export_manager/templates folder."

However I found no such file: export.tpl

Nope! Wow, that comment is VERY out of date. Smile I'll have to find & remove it. The actual HTML is generated via the Export Manager UI, as mentioned above.

Quote:I have also looked for a way to do this using the api, however that documentation is apparently incomplete

Ah, thanks for this. I'll update that page right now. Smile

Hope the above helps a bit...!
Reply
#3
[quote='Ben' pid='502' dateline='1239841185']
[quote]
Hope the above helps a bit...!
[/quote]

As always Ben, your advice is invaluable. Thanks.

Yes, my files are all image files, so this should do the trick. Can you apply a template to the html output page?

Just curious...
[quote='scaphis' pid='503' dateline='1239842438']
[quote='Ben' pid='502' dateline='1239841185']
[quote]
Hope the above helps a bit...!
[/quote]

Ok- just got it to work, uploaded my logo as a test, but the link was broken at first so I had to right click and see what it was referencing. It was looking for the image in my root, even though I have specified in settings>files to look in the formtools/upload folder. When I changed these settings to my root the image became visible once I re-uploaded it. I would rather not keep all of my images in the root folder, as not to become a cluttered mess.

I am sure you know how to fix this when I would spend hours trying.

Thanks Ben!
Reply
#4
that the block of PHP you're included appears BENEATH the opening <html> tags. It should always appear at the very top of the page, before anything else.
ahsan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)