<?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 SEO 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>Sat, 30 Jan 2010 22:31:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 to [...]<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[<div class="tweetmeme_button" style="float: right; margin: 0 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.topsemtips.com%2F2009%2F07%2Fphp-utf-8-and-simplexml%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.topsemtips.com%2F2009%2F07%2Fphp-utf-8-and-simplexml%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<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>$FileContents = file_get_contents( $URL ) ;<br />
  if ( $FileContents !== false )<br />
  {<br />
   $xml  = simplexml_load_string( utf8_encode( $FileContents ) ) ;</p>
<p>}</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[Programming]]></category>
		<category><![CDATA[jQuery]]></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) {
		//alert(e.keyCode);
		if(e.keyCode [...]<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>



Related posts:<ol><li><a href='http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/' rel='bookmark' title='Permanent Link: jQuery Automatic Trim of Input Fields'>jQuery Automatic Trim of Input Fields</a></li>
<li><a href='http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/' rel='bookmark' title='Permanent Link: Save HTML Table to Excel using jQuery'>Save HTML Table to Excel using jQuery</a></li>
<li><a href='http://www.topsemtips.com/2005/12/the-best-place-to-put-seo-copy-on-your-web-page/' rel='bookmark' title='Permanent Link: The Best Place to Put SEO Copy on Your Web Page'>The Best Place to Put SEO Copy on Your Web Page</a></li>
<li><a href='http://www.topsemtips.com/2009/12/page-load-speed-part-of-googles-algorithm/' rel='bookmark' title='Permanent Link: Page Load Speed Part of Google&#8217;s Algorithm'>Page Load Speed Part of Google&#8217;s Algorithm</a></li>
<li><a href='http://www.topsemtips.com/2005/04/review-landing-page-handbook-how-to-raise-conversions/' rel='bookmark' title='Permanent Link: Review: Landing Page Handbook: How to Raise Conversions'>Review: Landing Page Handbook: How to Raise Conversions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.topsemtips.com%2F2008%2F12%2Fjquery-add-a-default-button-to-a-page%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.topsemtips.com%2F2008%2F12%2Fjquery-add-a-default-button-to-a-page%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<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>Related posts:<ol><li><a href='http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/' rel='bookmark' title='Permanent Link: jQuery Automatic Trim of Input Fields'>jQuery Automatic Trim of Input Fields</a></li>
<li><a href='http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/' rel='bookmark' title='Permanent Link: Save HTML Table to Excel using jQuery'>Save HTML Table to Excel using jQuery</a></li>
<li><a href='http://www.topsemtips.com/2005/12/the-best-place-to-put-seo-copy-on-your-web-page/' rel='bookmark' title='Permanent Link: The Best Place to Put SEO Copy on Your Web Page'>The Best Place to Put SEO Copy on Your Web Page</a></li>
<li><a href='http://www.topsemtips.com/2009/12/page-load-speed-part-of-googles-algorithm/' rel='bookmark' title='Permanent Link: Page Load Speed Part of Google&#8217;s Algorithm'>Page Load Speed Part of Google&#8217;s Algorithm</a></li>
<li><a href='http://www.topsemtips.com/2005/04/review-landing-page-handbook-how-to-raise-conversions/' rel='bookmark' title='Permanent Link: Review: Landing Page Handbook: How to Raise Conversions'>Review: Landing Page Handbook: How to Raise Conversions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/feed/</wfw:commentRss>
		<slash:comments>0</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[Programming]]></category>
		<category><![CDATA[jQuery]]></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 TipsjQuery Automatic [...]<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>



Related posts:<ol><li><a href='http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/' rel='bookmark' title='Permanent Link: jQuery &#8211; Add a default button to a page'>jQuery &#8211; Add a default button to a page</a></li>
<li><a href='http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/' rel='bookmark' title='Permanent Link: Save HTML Table to Excel using jQuery'>Save HTML Table to Excel using jQuery</a></li>
<li><a href='http://www.topsemtips.com/2005/11/autoresponders-automatic-internet-marketing-success/' rel='bookmark' title='Permanent Link: Autoresponders = Automatic Internet Marketing Success'>Autoresponders = Automatic Internet Marketing Success</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.topsemtips.com%2F2008%2F12%2Fjquery-automatic-trim-of-input-fields%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.topsemtips.com%2F2008%2F12%2Fjquery-automatic-trim-of-input-fields%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<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>Related posts:<ol><li><a href='http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/' rel='bookmark' title='Permanent Link: jQuery &#8211; Add a default button to a page'>jQuery &#8211; Add a default button to a page</a></li>
<li><a href='http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/' rel='bookmark' title='Permanent Link: Save HTML Table to Excel using jQuery'>Save HTML Table to Excel using jQuery</a></li>
<li><a href='http://www.topsemtips.com/2005/11/autoresponders-automatic-internet-marketing-success/' rel='bookmark' title='Permanent Link: Autoresponders = Automatic Internet Marketing Success'>Autoresponders = Automatic Internet Marketing Success</a></li>
</ol></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:

&#60;form action="/SaveToExcel.php" method="post" target="_blank"
onsubmit='$("#datatodisplay").val( $("&#60;div&#62;").
append( $("#ReportTable").eq(0).clone() ).html() )'&#62;
&#60;input  type="image" src="/images/icons/Floppy-48x48.png" width="12" height="12"&#62;
&#60;input type="hidden" id="datatodisplay" name="datatodisplay" /&#62;
&#60;/form&#62;

Note &#8211; variables used [...]<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>



Related posts:<ol><li><a href='http://www.topsemtips.com/2006/07/html-meta-tags-what-are-they-and-how-do-you-use-them-on-your-website/' rel='bookmark' title='Permanent Link: HTML Meta Tags &#8211; What are they and how do you use them on your website?'>HTML Meta Tags &#8211; What are they and how do you use them on your website?</a></li>
<li><a href='http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/' rel='bookmark' title='Permanent Link: jQuery Automatic Trim of Input Fields'>jQuery Automatic Trim of Input Fields</a></li>
<li><a href='http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/' rel='bookmark' title='Permanent Link: jQuery &#8211; Add a default button to a page'>jQuery &#8211; Add a default button to a page</a></li>
<li><a href='http://www.topsemtips.com/2004/07/the-importance-of-clean-html-code/' rel='bookmark' title='Permanent Link: The Importance of Clean HTML Code'>The Importance of Clean HTML Code</a></li>
<li><a href='http://www.topsemtips.com/2006/01/search-engine-friendly-301-redirect-in-php/' rel='bookmark' title='Permanent Link: Search Engine Friendly 301 Redirect in PHP'>Search Engine Friendly 301 Redirect in PHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.topsemtips.com%2F2008%2F11%2Fsave-html-table-to-excel-using-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.topsemtips.com%2F2008%2F11%2Fsave-html-table-to-excel-using-jquery%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<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:</p>
<blockquote>
<pre>&lt;form action="/SaveToExcel.php" method="post" target="_blank"
onsubmit='$("#datatodisplay").val( $("&lt;div&gt;").
append( $("#ReportTable").eq(0).clone() ).html() )'&gt;</pre>
<pre>&lt;input  type="image" src="/images/icons/Floppy-48x48.png" width="12" height="12"&gt;</pre>
<pre>&lt;input type="hidden" id="datatodisplay" name="datatodisplay" /&gt;
&lt;/form&gt;</pre>
</blockquote>
<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>
<blockquote>
<pre>&lt;?php
header("Content-type: application/vnd.ms-excel; name='excel'");

header("Content-Disposition: filename=export.xls");
header("Pragma: no-cache");
header("Expires: 0");
?&gt;
&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;&lt;?=$_REQUEST['datatodisplay']?&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
</blockquote>
<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>Related posts:<ol><li><a href='http://www.topsemtips.com/2006/07/html-meta-tags-what-are-they-and-how-do-you-use-them-on-your-website/' rel='bookmark' title='Permanent Link: HTML Meta Tags &#8211; What are they and how do you use them on your website?'>HTML Meta Tags &#8211; What are they and how do you use them on your website?</a></li>
<li><a href='http://www.topsemtips.com/2008/12/jquery-automatic-trim-of-input-fields/' rel='bookmark' title='Permanent Link: jQuery Automatic Trim of Input Fields'>jQuery Automatic Trim of Input Fields</a></li>
<li><a href='http://www.topsemtips.com/2008/12/jquery-add-a-default-button-to-a-page/' rel='bookmark' title='Permanent Link: jQuery &#8211; Add a default button to a page'>jQuery &#8211; Add a default button to a page</a></li>
<li><a href='http://www.topsemtips.com/2004/07/the-importance-of-clean-html-code/' rel='bookmark' title='Permanent Link: The Importance of Clean HTML Code'>The Importance of Clean HTML Code</a></li>
<li><a href='http://www.topsemtips.com/2006/01/search-engine-friendly-301-redirect-in-php/' rel='bookmark' title='Permanent Link: Search Engine Friendly 301 Redirect in PHP'>Search Engine Friendly 301 Redirect in PHP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.topsemtips.com/2008/11/save-html-table-to-excel-using-jquery/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
