<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
 <generator>http://textpattern.com/</generator>
 <title>Textpattern Tips – Collect contact name and email before file download</title>
 <description>Collect contact name and email before file download - comments</description>
 <link>https://textpattern.tips/collect-contact-name-and-email-before-file-download</link>
 <atom:link href="https://textpattern.tips/collect-contact-name-and-email-before-file-download?f=comment-feed" rel="self" type="application/rss+xml" />
 <pubDate>Thu, 19 Mar 09 06:11:35 +0000</pubDate>

 <item>
     <title>Comment on Collect contact name and email before file download by Ryan Gardner</title>
     <link><a href="https://textpattern.tips/collect-contact-name-and-email-before-file-download#c000442" id="c000442">1</a></link>
     <guid><a href="https://textpattern.tips/collect-contact-name-and-email-before-file-download#c000442" id="c000442">1</a></guid>
     <pubDate>Thu, 19 Mar 09 06:11:35 +0000</pubDate>
     <description><![CDATA[<p>Great tip! I have a client who wanted this, but didn&#8217;t want people to have to click on the link to download the file &#8212; just wanted to have it download as soon as the user submitted the form. So I worked a little magic with the great <a href="http://forum.textpattern.com/viewtopic.php?id=25357" rel="nofollow">smd_if</a> plugin.</p><p>I did this before txp:variable came around so this might be possible without the smd_if plugin &#8230;</p><p>In the article the first line of the zem_contact plugin specify the file you want to download like this: </p>
<pre><code>&lt;txp:com_connect to="your-email@example.com" redirect="/download?file=27"&gt;</code></pre>
<p>Then I created a section called &#8220;download&#8221; with this code between the &lt;head&gt; and &lt;/head&gt; tags:</p>
<pre><code>&lt;txp:smd_if field="urlvar:file" operator="defined"&gt;
&lt;meta http-equiv="refresh" content="1; url=/file_download/{smd_if_file}"&gt;
&lt;/txp:smd_if&gt;
</code></pre>
<p>Then, just for good measure, I put the download link down in the body of the page just in case the user&#8217;s browser doesn&#8217;t refresh:</p>
<pre><code>&lt;txp:smd_if field="urlvar:file" operator="defined"&gt;Thanks for your request. Your file download should start now. If it doesn't, please &lt;a href="/file_download/{smd_if_file}"&gt;click Here&lt;/a&gt;
&lt;txp:else /&gt;
No download file was specified.
&lt;/txp:smd_if&gt;
</code></pre>
<p>I&#8217;m sure this could be refined, but it seems to work well.</p>]]></description>
     <content:encoded><![CDATA[<p>Great tip! I have a client who wanted this, but didn&#8217;t want people to have to click on the link to download the file &#8212; just wanted to have it download as soon as the user submitted the form. So I worked a little magic with the great <a href="http://forum.textpattern.com/viewtopic.php?id=25357" rel="nofollow">smd_if</a> plugin.</p><p>I did this before txp:variable came around so this might be possible without the smd_if plugin &#8230;</p><p>In the article the first line of the zem_contact plugin specify the file you want to download like this: </p>
<pre><code>&lt;txp:com_connect to="your-email@example.com" redirect="/download?file=27"&gt;</code></pre>
<p>Then I created a section called &#8220;download&#8221; with this code between the &lt;head&gt; and &lt;/head&gt; tags:</p>
<pre><code>&lt;txp:smd_if field="urlvar:file" operator="defined"&gt;
&lt;meta http-equiv="refresh" content="1; url=/file_download/{smd_if_file}"&gt;
&lt;/txp:smd_if&gt;
</code></pre>
<p>Then, just for good measure, I put the download link down in the body of the page just in case the user&#8217;s browser doesn&#8217;t refresh:</p>
<pre><code>&lt;txp:smd_if field="urlvar:file" operator="defined"&gt;Thanks for your request. Your file download should start now. If it doesn't, please &lt;a href="/file_download/{smd_if_file}"&gt;click Here&lt;/a&gt;
&lt;txp:else /&gt;
No download file was specified.
&lt;/txp:smd_if&gt;
</code></pre>
<p>I&#8217;m sure this could be refined, but it seems to work well.</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www.visualpeople.com">Ryan Gardner</a></dc:creator>
 
</item>

</channel>
</rss>