{"id":26113,"date":"2010-01-12T18:55:33","date_gmt":"2010-01-12T22:55:33","guid":{"rendered":"https:\/\/www.bu.edu\/tech\/?page_id=26113"},"modified":"2013-03-13T12:12:03","modified_gmt":"2013-03-13T16:12:03","slug":"templated-file","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/services\/cccs\/websites\/www\/non-wordpress\/marconi\/how-to\/templated-file\/","title":{"rendered":"How to Output to a File (Templates)"},"content":{"rendered":"<h3>Output Data using a File Template<\/h3>\n<p>A file template can be used while sending email with Telegraph, creating a list that is stored on the server, or when filling out an HTML guestbook page for your website.<\/p>\n<ul>\n<li>Add this line of code to your Telegraph configuration file:<br \/>\n<code>&lt;directive action=\"file\" filename=\"<strong>filename-relative-to-form<\/strong>\" template=\"<strong>template-location-relative-to-form<\/strong>\" <span style=\"font-weight: normal;\"> \/&gt;<\/span><em><span style=\"font-weight: normal;\"><\/p>\n<p><\/span><\/em><\/code><span style=\"font-weight: normal;\"><span style=\"font-weight: normal;\">Replace <strong>filename-relative-to-form<\/strong> with the name of your output file (including any relative path information) and <\/span><strong>template-location-relative-to-form<\/strong> with the location of your template file (also including any relative path information). <\/span><\/p>\n<ul>\n<li>Example:<br \/>\n<code>&lt;directive action=\"file\" filename=\"output\/military.txt\" template=\"templates\/military.template\" \/&gt;<\/code><\/li>\n<\/ul>\n<p>When creating your template file, use these guidelines:<\/p>\n<ul>\n<li>Indicate where the template submissions should be added to the output file using <strong>[template:begin] <\/strong>and <strong>[template:end]<\/strong>. Multiple submissions will be inserted in descending chronicle order.<\/li>\n<li>Use square-bracket field names to pull field information from your form.\n<ul>\n<li>Example: <strong>[serial-number]<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>A complete example template file might look like this:<\/p>\n<blockquote><p><code>[template:begin]<br \/>\n[name] has enlisted in the US Armed Services at the rank of [rank]. His\/her serial number is: [serial-number].<br \/>\n[template:end]<\/code><\/p><\/blockquote>\n<p>Output from a form using this template would look like this:<br \/>\n<code><br \/>\nJoe Schmoe has enlisted in the US Armed Services at the rank of Private. His\/her serial number is: 123-456-7890. <\/code><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Output Data using a File Template A file template can be used while sending email with Telegraph, creating a list that is stored on the server, or when filling out an HTML guestbook page for your website. Add this line of code to your Telegraph configuration file: &lt;directive action=&#8221;file&#8221; filename=&#8221;filename-relative-to-form&#8221; template=&#8221;template-location-relative-to-form&#8221; \/&gt; Replace filename-relative-to-form with&#8230;<\/p>\n","protected":false},"author":1282,"featured_media":0,"parent":26082,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/26113"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1282"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=26113"}],"version-history":[{"count":16,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/26113\/revisions"}],"predecessor-version":[{"id":63559,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/26113\/revisions\/63559"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/26082"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=26113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}