<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Top SEM Tips &#187; Programming</title>
	<atom:link href="http://www.topsemtips.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.topsemtips.com</link>
	<description>SEO and Link Building Tips</description>
	<lastBuildDate>Mon, 16 Jan 2012 19:20:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Issues Creating and Downloading File in IE from PHP</title>
		<link>http://www.topsemtips.com/2010/04/issues-creating-and-downloading-file-in-ie-from-php/</link>
		<comments>http://www.topsemtips.com/2010/04/issues-creating-and-downloading-file-in-ie-from-php/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 17:04:21 +0000</pubDate>
		<dc:creator>Dylan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.topsemtips.com/?p=515</guid>
		<description><![CDATA[Took a while to fix this one. The problem is you create a download button in HTML that leads to a PHP program that creates a file that Internet Explorer should download. The code works fine in Firefox just not IE. The original code was something like: {code type=php} header(&#8220;Pragma: no-cache&#8221;); header(&#8220;Expires: 0&#8243;); header(&#8220;Content-disposition: attachment; [...]<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2010/04/issues-creating-and-downloading-file-in-ie-from-php/">Issues Creating and Downloading File in IE from PHP</a></p>

No related posts.]]></description>
			<content:encoded><![CDATA[<p>Took a while to fix this one. The problem is you create a download button in HTML that leads to a PHP program that creates a file that Internet Explorer should download. The code works fine in Firefox just not IE.</p>
<p>The original code was something like:<br />
{code type=php}<br />
header(&#8220;Pragma: no-cache&#8221;);<br />
header(&#8220;Expires: 0&#8243;);</p>
<p>header(&#8220;Content-disposition: attachment; filename=\&#8221;export.xls\&#8221;;&#8221;);<br />
header(&#8220;Content-Type: application/vnd.ms-excel&#8221;);<br />
{/code}<br />
Which works in Firefox but not IE. The new code is:<br />
{code type=php}header(&#8220;Pragma: &#8220;);<br />
header(&#8220;Cache-Control: &#8220;);</p>
<p>header(&#8220;Content-disposition: attachment; filename=\&#8221;export.xls\&#8221;;&#8221;);<br />
header(&#8220;Content-Type: application/vnd.ms-excel&#8221;);<br />
{/code}<br />
And that works fine.</p>
<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2010/04/issues-creating-and-downloading-file-in-ie-from-php/">Issues Creating and Downloading File in IE from PHP</a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2010/04/issues-creating-and-downloading-file-in-ie-from-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP UTF-8 and simplexml</title>
		<link>http://www.topsemtips.com/2009/07/php-utf-8-and-simplexml/</link>
		<comments>http://www.topsemtips.com/2009/07/php-utf-8-and-simplexml/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 21:33:13 +0000</pubDate>
		<dc:creator>Dylan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.topsemtips.com/?p=449</guid>
		<description><![CDATA[Recently the page checking code was breaking when used on a site. The XML returned from the supplier was being read using file_get_contents() and passed straight into simplexml_load_string() which was then kicking out a UTF-8 Encoding Error. The way around this is to use utf8_encode() to ensure the string is encoded into UTF-8 before passing [...]<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2009/07/php-utf-8-and-simplexml/">PHP UTF-8 and simplexml</a></p>

No related posts.]]></description>
			<content:encoded><![CDATA[<p>Recently the page checking code was breaking when used on a site. The XML returned from the supplier was being read using file_get_contents() and passed straight into simplexml_load_string() which was then kicking out a UTF-8 Encoding Error.</p>
<p>The way around this is to use utf8_encode() to ensure the string is encoded into UTF-8 before passing to simplexml_load_string(). In this instance my code goes like:</p>
<p>{code type=php}<br />
$FileContents = file_get_contents( $URL ) ;<br />
if ( $FileContents !== false )<br />
{<br />
   $xml  = simplexml_load_string( utf8_encode( $FileContents ) ) ;<br />
}<br />
{/code}</p>
<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2009/07/php-utf-8-and-simplexml/">PHP UTF-8 and simplexml</a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2009/07/php-utf-8-and-simplexml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Add a default button to a page</title>
		<link>http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/</link>
		<comments>http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 21:59:10 +0000</pubDate>
		<dc:creator>Dylan</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.topsemtips.com/?p=411</guid>
		<description><![CDATA[Normally in HTML you can add a &#8216;input type=&#8221;submit&#8221;&#8216; to a page and it acts as a default button. However this only works if the input tag is within a &#8216;form&#8217;. I was using AJAX and found that adding a form caused the AJAX to fail. Instead I ended up with the following code: $(&#8216;input&#8217;).keyup(function(e) [...]<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/">jQuery &#8211; Add a default button to a page</a></p>

No related posts.]]></description>
			<content:encoded><![CDATA[<p>Normally in HTML you can add a &#8216;input type=&#8221;submit&#8221;&#8216; to a page and it acts as a default button. However this only works if the input tag is within a &#8216;form&#8217;. I was using AJAX and found that adding a form caused the AJAX to fail. Instead I ended up with the following code:</p>
<blockquote><p>	$(&#8216;input&#8217;).keyup(function(e) {<br />
		//alert(e.keyCode);<br />
		if(e.keyCode == 13) {<br />
			$(&#8216;#btnSubmit&#8217;).click() ;<br />
		}<br />
	});</p></blockquote>
<p>This adds to all input fields a keyup function that checks for the enter key and if found calls the click function on the button I want to use as the default button &#8211; in this case it&#8217;s an input button called &#8216;btnSubmit&#8217;.</p>
<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/">jQuery &#8211; Add a default button to a page</a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Automatic Trim of Input Fields</title>
		<link>http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/</link>
		<comments>http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 16:59:52 +0000</pubDate>
		<dc:creator>Dylan</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.topsemtips.com/?p=402</guid>
		<description><![CDATA[Really common task with a really easy solution $(function() { $(&#8220;input&#8221;).change( function() { $(this).attr(&#8220;value&#8221;, $.trim( $(this).attr(&#8220;value&#8221;) ) ) }); }); This attaches a function to the &#8216;change&#8217; event of all &#60;input&#62; tags. When the input field is changed it uses the built in &#8216;trim()&#8217; function of jquery to trim off whitespace. Post from: Top SEO [...]<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/">jQuery Automatic Trim of Input Fields</a></p>

No related posts.]]></description>
			<content:encoded><![CDATA[<p>Really common task with a really easy solution</p>
<p>$(function()<br />
{<br />
      $(&#8220;input&#8221;).change( function() { $(this).attr(&#8220;value&#8221;, $.trim( $(this).attr(&#8220;value&#8221;)	) )	});<br />
});</p>
<p>This attaches a function to the &#8216;change&#8217; event of all &lt;input&gt; tags. When the input field is changed it uses the built in <a href="http://docs.jquery.com/Utilities/jQuery.trim">&#8216;trim()&#8217; function of jquery</a> to trim off whitespace.</p>
<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/">jQuery Automatic Trim of Input Fields</a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Save HTML Table to Excel using jQuery</title>
		<link>http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/</link>
		<comments>http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:47:08 +0000</pubDate>
		<dc:creator>Dylan</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.topsemtips.com/?p=393</guid>
		<description><![CDATA[After a few hours work looking into this, this turned out really easy to implement using jQuery and server side PHP programming as follows: On the client side the following HTML code needs adding to the page (note this is older code &#8211; for newer code follow link at bottom): Note &#8211; variables used above [...]<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/">Save HTML Table to Excel using jQuery</a></p>

No related posts.]]></description>
			<content:encoded><![CDATA[<p>After a few hours work looking into this, this turned out really easy to implement using jQuery and server side PHP programming as follows:</p>
<p>On the client side the following HTML code needs adding to the page (note this is older code &#8211; for newer code follow link at bottom):</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;/SaveToExcel.php&quot; method=&quot;post&quot; target=&quot;_blank&quot;
onsubmit='$(&quot;#datatodisplay&quot;).val( $(&quot;&amp;lt;div&amp;gt;&quot;).append( $(&quot;#ReportTable&quot;).eq(0).clone() ).html() )'&gt;
&lt;input  type=&quot;image&quot; src=&quot;/images/icons/Floppy-48x48.png&quot; width=&quot;12&quot; height=&quot;12&quot; &gt;
&lt;input type=&quot;hidden&quot; id=&quot;datatodisplay&quot; name=&quot;datatodisplay&quot; /&gt;
&lt;/form&gt;
</pre>
<p>Note &#8211; variables used above &#8211; ReportTable is the id of the table you want to save and datatodisplay is a hidden variable used to post the table to the server.</p>
<p>The jQuery commands were added to the form&#8217;s onsubmit event but could easily be in your $(function(){}); fuction</p>
<p>The hard part here was getting all of the &lt;table&gt; HTML code. The standard jQuery .html() command gets the innerHTML and was cutting off the &lt;table&gt; HTML code. Getting all the HTML code was accomplished using the code $(&#8220;#datatodisplay&#8221;).val( $(&#8220;&lt;div&gt;&#8221;).append( $(&#8220;#ReportTable&#8221;).eq(0).clone() ).html() ) which effectively gets the outerHTML of the named HTML object (in this case the table we want to save to excel).</p>
<p>On the server side create a file called&#8217;SaveToExcel.php&#8217; and add the following code:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
header(&quot;Content-type: application/vnd.ms-excel; name='excel'&quot;);

header(&quot;Content-Disposition: filename=export.xls&quot;);
// Fix for crappy IE bug in download.
header(&quot;Pragma: &quot;);
header(&quot;Cache-Control: &quot;);
?&gt;
&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;&lt;?=$_REQUEST['datatodisplay']?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Updated: April 8, 2010 &#8211; modified to add fix for crappy IE download bug.<br />
Update: September 11, 2011 &#8211; new version of <a title="Jquery save to Excel" href="http://www.topsemtips.com/2011/09/jquery-save-to-excel-ii/">jquery save to excel</a> javascript code at <a href="http://www.topsemtips.com/2011/09/jquery-save-to-excel-ii/">http://www.topsemtips.com/2011/09/jquery-save-to-excel-ii/</a></p>
<p>Post from: <a href="http://www.topsemtips.com">Top SEO Tips</a><br/><br/><a href="http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/">Save HTML Table to Excel using jQuery</a></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc

Served from: www.topsemtips.com @ 2012-02-04 12:11:47 -->
