This module does more for txt that is required.
It adds "[]" before each row and "----------------------------------------" after, without a line feed in between, so rows are separated by "[]----------------------------------------"
Unless this is made configurable, better to do nothing (evrything it possible in the row itself).
I replaced in views-data-export-txt-body.tpl.php.bak.php:
foreach ($themed_rows as $count => $row):
foreach ($row as $field => $content):
?>
[<?php print $header[$field]; ?>]
<?php print strip_tags($content); // strip html so its plain txt. ?>
<?php endforeach; ?>
----------------------------------------
<?php endforeach;
by
foreach ($themed_rows as $count => $row):
foreach ($row as $field => $content):
?>
<?php print strip_tags($content); // strip html so its plain txt. ?>
<?php endforeach; ?>
<?php endforeach;
Comments
Comment #1
jvieille commentedActually, stripping all html gives no way to control the output, ie carriage return are impossible.
The correct code in views-data-export-txt-body.tpl.php for using txt output is the following:
Comment #2
steven jones commentedMaybe we should change text format so that less is output by default, then one could use rewrite field magic to get it to the correct format as desired.
Comment #3
steven jones commentedMaybe we should just provide a way to use a plainer output through the UI.
Comment #4
pzzd commentedA UI change to support more flexible formatting would be really great!
In the meantime, I was able to easily reformat the text output by making a template file. Here's how:
In Views - Other - Theme: Information - Alternative style, the template file name is listed there in bold. In my case, I'm formatting results for a RePEc submission, so the template is called 'views-data-export-txt-body--repec-templates.tpl.php'.
I created a new file at /sites/all/themes/mycustomtheme/templates/views-data-export-txt-body--repec-templates.tpl.php and tweaked the PHP for the right formatting. That started working immediately at https://mylovelysite.edu/repectemplates.
Comment #5
nwom commentedI agree. An option to remove both the "---------------" and "[]" would be amazing.
Comment #6
nwom commentedThanks to your template snippets, I was able to create exactly what I needed. Thanks!
I needed each row to be a new line and both the brackets and the lines removed. Here is the template that I ended up with.
Comment #7
nwom commentedComment #8
steven jones commentedSorry for the lack of attention to your issue, please accept my apologies.
Drupal 7 is going to be end-of-life'd by the community in approximately 1 month.
As such, I am closing all non-critical looking, non-PHP compatibility issues for Views Data Export to tidy up the issue queues and reduce the noise. You can read about this on #3492246: Close down Drupal 7 issues.
If you feel like this issue has been closed by mistake, please do comment about re-opening it.
If you feel like the ticket is still relevant for the 8.x-1.x version of the module, then please search for a duplicate issue first, and if there really isn't one (and you've looked properly) then change the version on the ticket and re-open.
Thanks to everyone involved in this issue: for reporting it, and moving it along, it is truly appreciated.
The Drupal community wouldn't be what it is today without your involvement and effort, so I'm sorry that we couldn't get this issue resolved. Hopefully we'll work together in a future issue though, and get that one resolved :)