ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to output a TXT file?

February 08, 2013 3:46pm

Subscribe [2]
  • #1 / Feb 08, 2013 3:46pm

    Trejure

    13 posts

    I’m wondering if it’s possible to output a plain text from from ExpressionEngine just like you would a CSS, JS, or XML file.

    I’m rebuilding my portfolio site and have two places where I want certain content, like employment history, to live: 1) on the “about” page as live HTML and 2) in a downloadable resume, in TXT format.

    Naturally storing this kind of content once within ExpressionEngine’s database would be nice, that way I can output it simultaneously to both places and never have to worry about updating content in two different places.

    Anyone know of how to go about this?

  • #2 / Feb 08, 2013 4:13pm

    Create a New Template, give it a name such as “Document.txt” and use CSS template type and the document will then be available at http://www.example.com/template_group/Document.txt

  • #3 / Feb 08, 2013 4:17pm

    wildrock

    262 posts

    Just create a template, set it as a CSS type template (this will set line breaks for you), and name it resume.txt.

    Setup your Channel tags to pull the info into the template, then access it via a direct call to the template, ../template-group/resume.txt

    If you want to force a file download use something like Download Content

  • #4 / Feb 08, 2013 5:15pm

    Trejure

    13 posts

    This is a revolution in my EE workflow, thanks guys!

    Just for the record, if you set it as the default template type (Web Page) you will lose formatting of new lines/breaks and such. Setting it to CSS, as wildrock mentioned, will set line breaks for you.

    Yay!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases