<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8848627081796627656</id><updated>2024-11-08T07:37:10.624-08:00</updated><category term="web 2.0"/><category term="jquery"/><category term="php"/><category term="how to"/><category term="magento"/><category term="tips n tricks"/><category term="webdesign"/><category term="api"/><category term="javascript"/><category term="jquery mobile"/><category term="mobile"/><category term="technology"/><category term="ESPN"/><category term="google"/><category term="google maps"/><category term="jquery-plugin"/><category term="magento-extension"/><category term="module"/><category term="tikiwiki"/><category term="twitter"/><category term="webservice"/><category term="wordpress"/><category term="facebook"/><category term="facebook api"/><title type='text'>Jquery Giants</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-8126967288886400792</id><published>2012-05-17T00:16:00.001-07:00</published><updated>2012-05-20T22:39:41.330-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to"/><category scheme="http://www.blogger.com/atom/ns#" term="tips n tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="wordpress"/><title type='text'>Insert &amp;#39;Read More&amp;#39; button in Blogger Imported posts in Wordpress</title><content type='html'>&lt;div dir=&quot;ltr&quot; class=&quot;post-text&quot; trbidi=&quot;on&quot;&gt;If you have just imported your posts and comments from Blogger to&amp;nbsp;WordPress&amp;nbsp;then you might have faced two problems:&lt;br /&gt;1. There is a &#39;&amp;gt;&#39; symbol prepended to each post title and post content.&lt;br /&gt;2. Your &#39;Read more&#39; button from blogger posts is missing.&lt;br /&gt;I have found a simple solution for these problems.&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;h2&gt; Removing &#39;&amp;gt;&#39; symbol form WordPress posts&lt;/h2&gt;To remove &#39;&amp;gt;&#39; symbol from post titles and content, just run following two queries on  you wordpress database: &lt;br /&gt;&lt;pre class=&quot;brush:sql&quot;&gt;UPDATE wp_posts SET post_title = TRIM(LEADING &#39;&amp;gt;&#39; FROM post_title)&lt;br /&gt;UPDATE wp_posts SET post_content = TRIM(LEADING &#39;&amp;gt;&#39; FROM post_content)&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt; Adding &#39;Read More&#39; link in WordPress posts&lt;/h2&gt;To add &#39;Read More&#39; link in blogger imported posts you need to run following MySql query on your wordpress database:  &lt;br /&gt;&lt;pre class=&quot;brush:sql&quot;&gt;UPDATE wp_posts SET post_content = REPLACE(post_content, &quot;&amp;lt;a name=&#39;more&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot;, &#39;&amp;lt;!--more--&amp;gt;&#39;);&lt;br /&gt;UPDATE wp_posts SET post_content = REPLACE(post_content, &quot;&amp;lt;a name=&quot;more&quot;&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot;, &#39;&amp;lt;!--more--&amp;gt;&#39;);&lt;br /&gt;&lt;/pre&gt;Blogger identifies the &#39;Read More&#39; link by &quot;&amp;lt;a name=&#39;more&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot; code snippet. But WordPress does this by finding &quot;&amp;lt;!--more--&amp;gt;&quot;. So we have replaced all occurrences of &quot;&amp;lt;a name=&#39;more&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot; with &quot;&amp;lt;!--more--&amp;gt;&quot;. Hope this works for you.&lt;br /&gt;Note: Please take backup of your database before applying above hacks. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/8126967288886400792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/insert-more-button-in-blogger-imported_17.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8126967288886400792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8126967288886400792'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/insert-more-button-in-blogger-imported_17.html' title='Insert &amp;#39;Read More&amp;#39; button in Blogger Imported posts in Wordpress'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-6854911022476272395</id><published>2012-05-17T00:16:00.000-07:00</published><updated>2012-05-20T22:39:41.313-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to"/><category scheme="http://www.blogger.com/atom/ns#" term="tips n tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="wordpress"/><title type='text'>Insert &amp;#39;Read More&amp;#39; button in Blogger Imported posts in Wordpress</title><content type='html'>&lt;div dir=&quot;ltr&quot; class=&quot;post-text&quot; trbidi=&quot;on&quot;&gt;If you have just imported your posts and comments from Blogger to&amp;nbsp;WordPress&amp;nbsp;then you might have faced two problems:&lt;br /&gt;1. There is a &#39;&amp;gt;&#39; symbol prepended to each post title and post content.&lt;br /&gt;2. Your &#39;Read more&#39; button from blogger posts is missing.&lt;br /&gt;I have found a simple solution for these problems.&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;h2&gt; Removing &#39;&amp;gt;&#39; symbol form WordPress posts&lt;/h2&gt;To remove &#39;&amp;gt;&#39; symbol from post titles and content, just run following two queries on  you wordpress database: &lt;br /&gt;&lt;pre class=&quot;brush:sql&quot;&gt;UPDATE wp_posts SET post_title = TRIM(LEADING &#39;&amp;gt;&#39; FROM post_title)&lt;br /&gt;UPDATE wp_posts SET post_content = TRIM(LEADING &#39;&amp;gt;&#39; FROM post_content)&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt; Adding &#39;Read More&#39; link in WordPress posts&lt;/h2&gt;To add &#39;Read More&#39; link in blogger imported posts you need to run following MySql query on your wordpress database:  &lt;br /&gt;&lt;pre class=&quot;brush:sql&quot;&gt;UPDATE wp_posts SET post_content = REPLACE(post_content, &quot;&amp;lt;a name=&#39;more&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot;, &#39;&amp;lt;!--more--&amp;gt;&#39;);&lt;br /&gt;UPDATE wp_posts SET post_content = REPLACE(post_content, &quot;&amp;lt;a name=&quot;more&quot;&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot;, &#39;&amp;lt;!--more--&amp;gt;&#39;);&lt;br /&gt;&lt;/pre&gt;Blogger identifies the &#39;Read More&#39; link by &quot;&amp;lt;a name=&#39;more&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot; code snippet. But WordPress does this by finding &quot;&amp;lt;!--more--&amp;gt;&quot;. So we have replaced all occurrences of &quot;&amp;lt;a name=&#39;more&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot; with &quot;&amp;lt;!--more--&amp;gt;&quot;. Hope this works for you.&lt;br /&gt;Note: Please take backup of your database before applying above hacks. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/6854911022476272395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/insert-more-button-in-blogger-imported.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/6854911022476272395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/6854911022476272395'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/insert-more-button-in-blogger-imported.html' title='Insert &amp;#39;Read More&amp;#39; button in Blogger Imported posts in Wordpress'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-6385825737957526517</id><published>2012-05-16T04:41:00.001-07:00</published><updated>2012-05-20T22:39:41.305-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery-plugin"/><category scheme="http://www.blogger.com/atom/ns#" term="webdesign"/><title type='text'>jCouch - A jQuery Plugin for Distraction Free Page View</title><content type='html'>&lt;div dir=&quot;ltr&quot; class=&quot;post-text&quot; trbidi=&quot;on&quot;&gt;jCouch is a very lightweight jQuery plugin that provides you the feature of viewing a web page in distraction free mode. If your website is text oriented and the visitors on your site prefer reading your site content then this plugin will allow the users to read your web pages in the most convenient way without being distracted by other less useful content on the site. The plugin allows you to combine the selective parts of the web page in a single view. See the &lt;a href=&quot;http://demos.webspeaks.in/jCouch/&quot; target=&quot;_blank&quot;&gt;live demo&lt;/a&gt;.&lt;br /&gt;&amp;nbsp;&lt;b&gt;Features&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Light weight&lt;/li&gt;&lt;li&gt;Easily customizable&lt;/li&gt;&lt;li&gt;Zoom text feature&lt;/li&gt;&lt;li&gt;Full jQuery Selectors Support&lt;/li&gt;&lt;li&gt;Disable on pressing &#39;Esc&#39;&lt;/li&gt;&lt;/ul&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;a class=&quot;couchBtn demo&quot; href=&quot;http://demos.webspeaks.in/jCouch/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;https://www.box.com/s/afcdb2ffdddc0d7024f6&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;h2&gt;  Options&lt;/h2&gt;&lt;pre&gt;&lt;b&gt;target: &lt;/b&gt;(required, string) The elememts to be included in couch mode (comma separated), eg. #header, .post-body, h2&lt;br /&gt;&lt;b&gt;bgColor: &lt;/b&gt;(optional, string) Background color of the couch mode. eg. &#39;#ffffff&#39;, &#39;red&#39; etc. Default is white&lt;br /&gt;&lt;b&gt;width:&lt;/b&gt;(optional, string) Width of the content in couch mode. eg.&#39;500px&#39;, &#39;65%&#39;. Default is full screen.&lt;br /&gt;&lt;b&gt;amplify:&lt;/b&gt;(optional, numeric) Factor by which the text-size is to be zoomed. eg. 0.2, 0.5 etc.&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;  How to Use&lt;/h2&gt;You need to include following files in your web page before using jCouch: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;jCouch CSS file&lt;/li&gt;&lt;li&gt;jQuery library file&lt;/li&gt;&lt;li&gt;jCouch JS file&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;&amp;lt;link href=&quot;jCouch.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;jCouch.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;  Sample Usage 1&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; // The selectors of couch buttons&lt;br /&gt; // Multiple selectors can be used to enable couch mode&lt;br /&gt; $(&#39;.couchBtn, .couchImg&#39;).jCouch({&lt;br /&gt;  target: &#39;h1,#post-data&#39;, //list of elements to be couched&lt;br /&gt;  bgColor: &#39;#ffffff&#39;,  //background color&lt;br /&gt;  width: &#39;500px&#39;,   //width of couched content&lt;br /&gt;  amplify: 0.2   //Factor by which text is to be zoomed&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;h2&gt;  Sample Usage 2&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; $(&#39;#couchBtn2&#39;).jCouch({&lt;br /&gt;  target:&#39;#leftcol .widgets&#39;,&lt;br /&gt;  bgColor: &#39;#f7f7f7&#39;&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;h2&gt;  Sample Usage 3&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; $(&#39;#couchBtn3&#39;).jCouch({&lt;br /&gt;  target:&#39;#leftcol .widgets:nth-child(2)&#39;, //jQuery selectors are supported in target&lt;br /&gt;  bgColor: &#39;#C1371A&#39;,&lt;br /&gt;  width: &#39;250px&#39;&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;h2&gt;  Sample Usage 4&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; $(&#39;#fbcouchBtn&#39;).jCouch({&lt;br /&gt;  target:&#39;#rightcol .widgets:nth-child(2)&#39;,&lt;br /&gt;  bgColor: &#39;#3B5998&#39;,&lt;br /&gt;  width: &#39;250px&#39;&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/6385825737957526517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/jcouch-jquery-plugin-for-distraction_16.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/6385825737957526517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/6385825737957526517'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/jcouch-jquery-plugin-for-distraction_16.html' title='jCouch - A jQuery Plugin for Distraction Free Page View'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-8733968680576925954</id><published>2012-05-16T04:41:00.000-07:00</published><updated>2012-05-20T22:39:41.340-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery-plugin"/><category scheme="http://www.blogger.com/atom/ns#" term="webdesign"/><title type='text'>jCouch - A jQuery Plugin for Distraction Free Page View</title><content type='html'>&lt;div dir=&quot;ltr&quot; class=&quot;post-text&quot; trbidi=&quot;on&quot;&gt;jCouch is a very lightweight jQuery plugin that provides you the feature of viewing a web page in distraction free mode. If your website is text oriented and the visitors on your site prefer reading your site content then this plugin will allow the users to read your web pages in the most convenient way without being distracted by other less useful content on the site. The plugin allows you to combine the selective parts of the web page in a single view. See the &lt;a href=&quot;http://demos.webspeaks.in/jCouch/&quot; target=&quot;_blank&quot;&gt;live demo&lt;/a&gt;.&lt;br /&gt;&amp;nbsp;&lt;b&gt;Features&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Light weight&lt;/li&gt;&lt;li&gt;Easily customizable&lt;/li&gt;&lt;li&gt;Zoom text feature&lt;/li&gt;&lt;li&gt;Full jQuery Selectors Support&lt;/li&gt;&lt;li&gt;Disable on pressing &#39;Esc&#39;&lt;/li&gt;&lt;/ul&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;a class=&quot;couchBtn demo&quot; href=&quot;http://demos.webspeaks.in/jCouch/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;https://www.box.com/s/afcdb2ffdddc0d7024f6&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;h2&gt;  Options&lt;/h2&gt;&lt;pre&gt;&lt;b&gt;target: &lt;/b&gt;(required, string) The elememts to be included in couch mode (comma separated), eg. #header, .post-body, h2&lt;br /&gt;&lt;b&gt;bgColor: &lt;/b&gt;(optional, string) Background color of the couch mode. eg. &#39;#ffffff&#39;, &#39;red&#39; etc. Default is white&lt;br /&gt;&lt;b&gt;width:&lt;/b&gt;(optional, string) Width of the content in couch mode. eg.&#39;500px&#39;, &#39;65%&#39;. Default is full screen.&lt;br /&gt;&lt;b&gt;amplify:&lt;/b&gt;(optional, numeric) Factor by which the text-size is to be zoomed. eg. 0.2, 0.5 etc.&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;  How to Use&lt;/h2&gt;You need to include following files in your web page before using jCouch: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;jCouch CSS file&lt;/li&gt;&lt;li&gt;jQuery library file&lt;/li&gt;&lt;li&gt;jCouch JS file&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;&amp;lt;link href=&quot;jCouch.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;jCouch.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;  Sample Usage 1&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; // The selectors of couch buttons&lt;br /&gt; // Multiple selectors can be used to enable couch mode&lt;br /&gt; $(&#39;.couchBtn, .couchImg&#39;).jCouch({&lt;br /&gt;  target: &#39;h1,#post-data&#39;, //list of elements to be couched&lt;br /&gt;  bgColor: &#39;#ffffff&#39;,  //background color&lt;br /&gt;  width: &#39;500px&#39;,   //width of couched content&lt;br /&gt;  amplify: 0.2   //Factor by which text is to be zoomed&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;h2&gt;  Sample Usage 2&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; $(&#39;#couchBtn2&#39;).jCouch({&lt;br /&gt;  target:&#39;#leftcol .widgets&#39;,&lt;br /&gt;  bgColor: &#39;#f7f7f7&#39;&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;h2&gt;  Sample Usage 3&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; $(&#39;#couchBtn3&#39;).jCouch({&lt;br /&gt;  target:&#39;#leftcol .widgets:nth-child(2)&#39;, //jQuery selectors are supported in target&lt;br /&gt;  bgColor: &#39;#C1371A&#39;,&lt;br /&gt;  width: &#39;250px&#39;&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;h2&gt;  Sample Usage 4&lt;/h2&gt;&lt;pre&gt;$(function(){&lt;br /&gt; $(&#39;#fbcouchBtn&#39;).jCouch({&lt;br /&gt;  target:&#39;#rightcol .widgets:nth-child(2)&#39;,&lt;br /&gt;  bgColor: &#39;#3B5998&#39;,&lt;br /&gt;  width: &#39;250px&#39;&lt;br /&gt; });&lt;br /&gt;});   &lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/8733968680576925954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/jcouch-jquery-plugin-for-distraction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8733968680576925954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8733968680576925954'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/jcouch-jquery-plugin-for-distraction.html' title='jCouch - A jQuery Plugin for Distraction Free Page View'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-7226357684433389948</id><published>2012-05-09T02:54:00.001-07:00</published><updated>2012-05-20T22:39:41.319-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to"/><category scheme="http://www.blogger.com/atom/ns#" term="module"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="tikiwiki"/><title type='text'>How to create custom module in TikiWiki</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Tiki_Wiki_CMS_Groupware&quot; rel=&quot;nofollow&quot;&gt;TikiWiki&lt;/a&gt; or simply Tiki, is a free and open source wiki-based, content management system and Online office suite written primarily in PHP. Tiki is a powerful all-in-one web-based application, offering collaboration, publishing, commerce, social networking, CRM and office productivity tools. If you have just started your Tiki development then you will frequently need to create custom &lt;a href=&quot;http://doc.tiki.org/Module&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;modules&lt;/a&gt; in TikiWiki. In this article I will tell you how to create your custom TikiWiki module from scratch. For creating you own module, you need to add two files in TikiWiki:&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;A php module file&lt;/li&gt;&lt;li&gt;A smarty template file&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2&gt;    Create the PHP module file&lt;/h2&gt;Suppose the name of your module is &#39;Custom Module&#39;, then your module file will be named as &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mod-func-custom_module.php&lt;/span&gt;&#39;. This file will contain two important functions. The function with &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;_info&lt;/span&gt;&#39; as suffix will contain the basic information of your module like name, description, required parameters etc. The second function &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;module_&amp;lt;module_name&amp;gt;&lt;/span&gt;&#39; will contain the core functionality of your module. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;//this script may only be included - so its better to die if called directly.&lt;br /&gt;if (strpos($_SERVER[&quot;SCRIPT_NAME&quot;],basename(__FILE__)) !== false) {&lt;br /&gt;  header(&quot;location: index.php&quot;);&lt;br /&gt;  exit;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function module_custom_module_info() {&lt;br /&gt; return array(&lt;br /&gt;  &#39;name&#39; =&amp;gt; tra(&#39;Custom Module&#39;),&lt;br /&gt;  &#39;description&#39; =&amp;gt; tra(&#39;This is a custom module.&#39;),&lt;br /&gt;  &#39;prefs&#39; =&amp;gt; array( ),&lt;br /&gt;  &#39;params&#39; =&amp;gt; array(&lt;br /&gt;   &#39;username&#39; =&amp;gt; array(&lt;br /&gt;    &#39;required&#39; =&amp;gt; true,&lt;br /&gt;    &#39;name&#39; =&amp;gt; tra(&#39;Username&#39;),&lt;br /&gt;    &#39;description&#39; =&amp;gt; tra(&#39;Please enter username.&#39;)&lt;br /&gt;   ),&lt;br /&gt;   &#39;Email&#39; =&amp;gt; array(&lt;br /&gt;    &#39;required&#39; =&amp;gt; true,&lt;br /&gt;    &#39;name&#39; =&amp;gt; tra(&#39;email&#39;),&lt;br /&gt;    &#39;description&#39; =&amp;gt; tra(&#39;Please enter Password&#39;)&lt;br /&gt;    &#39;required&#39; =&amp;gt; true,&lt;br /&gt;    &#39;name&#39; =&amp;gt; tra(&#39;db&#39;),&lt;br /&gt;   )&lt;br /&gt;  &#39;common_params&#39; =&amp;gt; array(&#39;nonums&#39;, &#39;rows&#39;)&lt;br /&gt; );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Create the module function&lt;br /&gt;function module_custom_module( $mod_reference, $module_params ) {&lt;br /&gt; global $smarty, $tikilib, $user;&lt;br /&gt;&lt;br /&gt; #Get module parameters&lt;br /&gt; $username = $module_params[&#39;username&#39;];&lt;br /&gt; $email = $module_params[&#39;email&#39;];&lt;br /&gt;&lt;br /&gt; $smarty-&amp;gt;assign(&#39;username&#39;, $username);&lt;br /&gt; $smarty-&amp;gt;assign(&#39;email&#39;, $email);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    Create the PHP smarty template file&lt;/h2&gt;TikiWiki uses smarty as the template engine. Template file is mandatory for module creation. Each module has a separate template file. The convention for naming the template file is as &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mod-&amp;lt;module_name&amp;gt;.tpl&lt;/span&gt;&#39;. So our module template file will be &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mod-custom_module.tpl&lt;/span&gt;&#39;. In this file we will print the smarty variables assigned in the module PHP file. &lt;br /&gt;&lt;pre class=&quot;brush:html&quot;&gt;Username: {$username}&lt;br /&gt;Email: {$email}&lt;br /&gt;&lt;/pre&gt;Don&#39;t forget to clear your TikiWiki cache before the new module can appear in the modules list.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/7226357684433389948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-create-custom-module-in-tikiwiki_09.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7226357684433389948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7226357684433389948'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-create-custom-module-in-tikiwiki_09.html' title='How to create custom module in TikiWiki'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-60702279737321100</id><published>2012-05-09T02:54:00.000-07:00</published><updated>2012-05-20T22:39:41.298-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to"/><category scheme="http://www.blogger.com/atom/ns#" term="module"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="tikiwiki"/><title type='text'>How to create custom module in TikiWiki</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Tiki_Wiki_CMS_Groupware&quot; rel=&quot;nofollow&quot;&gt;TikiWiki&lt;/a&gt; or simply Tiki, is a free and open source wiki-based, content management system and Online office suite written primarily in PHP. Tiki is a powerful all-in-one web-based application, offering collaboration, publishing, commerce, social networking, CRM and office productivity tools. If you have just started your Tiki development then you will frequently need to create custom &lt;a href=&quot;http://doc.tiki.org/Module&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;modules&lt;/a&gt; in TikiWiki. In this article I will tell you how to create your custom TikiWiki module from scratch. For creating you own module, you need to add two files in TikiWiki:&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;A php module file&lt;/li&gt;&lt;li&gt;A smarty template file&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h2&gt;    Create the PHP module file&lt;/h2&gt;Suppose the name of your module is &#39;Custom Module&#39;, then your module file will be named as &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mod-func-custom_module.php&lt;/span&gt;&#39;. This file will contain two important functions. The function with &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;_info&lt;/span&gt;&#39; as suffix will contain the basic information of your module like name, description, required parameters etc. The second function &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;module_&amp;lt;module_name&amp;gt;&lt;/span&gt;&#39; will contain the core functionality of your module. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;//this script may only be included - so its better to die if called directly.&lt;br /&gt;if (strpos($_SERVER[&quot;SCRIPT_NAME&quot;],basename(__FILE__)) !== false) {&lt;br /&gt;  header(&quot;location: index.php&quot;);&lt;br /&gt;  exit;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function module_custom_module_info() {&lt;br /&gt; return array(&lt;br /&gt;  &#39;name&#39; =&amp;gt; tra(&#39;Custom Module&#39;),&lt;br /&gt;  &#39;description&#39; =&amp;gt; tra(&#39;This is a custom module.&#39;),&lt;br /&gt;  &#39;prefs&#39; =&amp;gt; array( ),&lt;br /&gt;  &#39;params&#39; =&amp;gt; array(&lt;br /&gt;   &#39;username&#39; =&amp;gt; array(&lt;br /&gt;    &#39;required&#39; =&amp;gt; true,&lt;br /&gt;    &#39;name&#39; =&amp;gt; tra(&#39;Username&#39;),&lt;br /&gt;    &#39;description&#39; =&amp;gt; tra(&#39;Please enter username.&#39;)&lt;br /&gt;   ),&lt;br /&gt;   &#39;Email&#39; =&amp;gt; array(&lt;br /&gt;    &#39;required&#39; =&amp;gt; true,&lt;br /&gt;    &#39;name&#39; =&amp;gt; tra(&#39;email&#39;),&lt;br /&gt;    &#39;description&#39; =&amp;gt; tra(&#39;Please enter Password&#39;)&lt;br /&gt;    &#39;required&#39; =&amp;gt; true,&lt;br /&gt;    &#39;name&#39; =&amp;gt; tra(&#39;db&#39;),&lt;br /&gt;   )&lt;br /&gt;  &#39;common_params&#39; =&amp;gt; array(&#39;nonums&#39;, &#39;rows&#39;)&lt;br /&gt; );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Create the module function&lt;br /&gt;function module_custom_module( $mod_reference, $module_params ) {&lt;br /&gt; global $smarty, $tikilib, $user;&lt;br /&gt;&lt;br /&gt; #Get module parameters&lt;br /&gt; $username = $module_params[&#39;username&#39;];&lt;br /&gt; $email = $module_params[&#39;email&#39;];&lt;br /&gt;&lt;br /&gt; $smarty-&amp;gt;assign(&#39;username&#39;, $username);&lt;br /&gt; $smarty-&amp;gt;assign(&#39;email&#39;, $email);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    Create the PHP smarty template file&lt;/h2&gt;TikiWiki uses smarty as the template engine. Template file is mandatory for module creation. Each module has a separate template file. The convention for naming the template file is as &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mod-&amp;lt;module_name&amp;gt;.tpl&lt;/span&gt;&#39;. So our module template file will be &#39;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mod-custom_module.tpl&lt;/span&gt;&#39;. In this file we will print the smarty variables assigned in the module PHP file. &lt;br /&gt;&lt;pre class=&quot;brush:html&quot;&gt;Username: {$username}&lt;br /&gt;Email: {$email}&lt;br /&gt;&lt;/pre&gt;Don&#39;t forget to clear your TikiWiki cache before the new module can appear in the modules list.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/60702279737321100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-create-custom-module-in-tikiwiki.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/60702279737321100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/60702279737321100'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-create-custom-module-in-tikiwiki.html' title='How to create custom module in TikiWiki'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-8826243491717248819</id><published>2012-05-08T04:46:00.001-07:00</published><updated>2012-05-20T22:39:41.343-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="technology"/><category scheme="http://www.blogger.com/atom/ns#" term="tips n tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="webdesign"/><title type='text'>How to Test PHP Emails on Localhost</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;While developing web applications on localhost you must have always missed the functionality to send mails. As localhost does not support email service, so it has always been a bottleneck for email testing on localhost. But I have found a simple way to test emails on localhost using PHP. I have overridden the default &lt;span style=&quot;background-color: orange; color: white; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mail()&lt;/span&gt; function of PHP to create a text/html file based on the email format. If the email is in html format, an HTML file is created otherwise a text file is created. You can see in this file what exactly is the content sent in your mail. &lt;a href=&quot;http://demos.webspeaks.in/localMail/&quot; target=&quot;_blank&quot;&gt;See how does it work&lt;/a&gt;.&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.webspeaks.in/localMail/&quot; target=&quot;_blank&quot;&gt;Live demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://demos.webspeaks.in/d/?f=localMail/localMail.zip&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;h2&gt;    Overriding the mail() function&lt;/h2&gt;To override the PHP mail() function, we need to create our namespace and then define the function in that namespace. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;#Create your own namespace&lt;br /&gt;namespace localMail;&lt;br /&gt;&lt;br /&gt;#Override the default mail function&lt;br /&gt;function mail( $to, $subject, $message, $additional_headers=&#39;&#39;, $additional_parameters=&#39;&#39; ) {&lt;br /&gt; if (empty($to) || empty($subject) || empty($message)) {&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Check if email is sent as HTML or plaintext&lt;br /&gt; if (isHTML($additional_headers)) {&lt;br /&gt;  $ext = &#39;html&#39;;&lt;br /&gt; }else{&lt;br /&gt;  $ext = &#39;txt&#39;;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Write the file&lt;br /&gt; $myFile = &quot;mail_&quot;.time().&quot;.&quot;.$ext;&lt;br /&gt; $fh = fopen($myFile, &#39;w&#39;) or die(&quot;can&#39;t open file&quot;);&lt;br /&gt; fwrite($fh, $message);&lt;br /&gt; fclose($fh);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Function to detect HTML headers&lt;br /&gt;function isHTML($isithtml) {&lt;br /&gt; if (strpos($isithtml, &#39;html&#39;)) {&lt;br /&gt;  return true;&lt;br /&gt; } else {&lt;br /&gt;  return false;&lt;br /&gt; } &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    Usage&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt; &amp;lt;title&amp;gt;Test Emails on localhost ! WebSpeaks.in&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt; &amp;lt;form method=&quot;post&quot; action=&quot;send_mail.php&quot;&amp;gt;&lt;br /&gt; &amp;lt;table align=&quot;center&quot;&amp;gt;&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td&amp;gt;&lt;br /&gt;    Type your message&amp;lt;br /&amp;gt;&lt;br /&gt;    &amp;lt;textarea name=&quot;message&quot; cols=&quot;50&quot; rows=&quot;5&quot;&amp;gt;&amp;lt;div style=&quot;color:#c3c;&quot;&amp;gt;This &amp;lt;i&amp;gt;email&amp;lt;/i&amp;gt; is &amp;lt;u&amp;gt;sent&amp;lt;/u&amp;gt; through &amp;lt;a href=&quot;#&quot;&amp;gt;localhost&amp;lt;/a&amp;gt;.&amp;lt;/div&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;/tr&amp;gt;&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td colspan=&quot;2&quot; align=&quot;right&quot;&amp;gt;&lt;br /&gt;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;send_text&quot; value=&quot;Send as Plain Text&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;send_html&quot; value=&quot;Send as HTML&quot; /&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;/tr&amp;gt;&lt;br /&gt; &amp;lt;/table&amp;gt;&lt;br /&gt; &amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    send_mail.php&lt;/h2&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;namespace localMail;&lt;br /&gt;#Override the default mail function&lt;br /&gt;function mail( $to, $subject, $message, $additional_headers=&#39;&#39;, $additional_parameters=&#39;&#39; ) {&lt;br /&gt; if (empty($to) || empty($subject) || empty($message)) {&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Check if email is sent as HTML or plaintext&lt;br /&gt; if (isHTML($additional_headers)) {&lt;br /&gt;  $ext = &#39;html&#39;;&lt;br /&gt; }else{&lt;br /&gt;  $ext = &#39;txt&#39;;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Write the file&lt;br /&gt; $myFile = &quot;mail_&quot;.time().&quot;.&quot;.$ext;&lt;br /&gt; $fh = fopen($myFile, &#39;w&#39;) or die(&quot;can&#39;t open file&quot;);&lt;br /&gt; fwrite($fh, $message);&lt;br /&gt; fclose($fh);&lt;br /&gt;&lt;br /&gt; header(&#39;Content-disposition: attachment; filename=&#39;.$myFile);&lt;br /&gt; if (isHTML($additional_headers)) {&lt;br /&gt;  header(&#39;Content-type: application/html&#39;);&lt;br /&gt; } else {&lt;br /&gt;  header(&#39;Content-type: application/text&#39;);&lt;br /&gt; }&lt;br /&gt; readfile($myFile);&lt;br /&gt; unlink($myFile);&lt;br /&gt; die();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Function to detect HTML headers&lt;br /&gt;function isHTML($isithtml) {&lt;br /&gt; if (strpos($isithtml, &#39;html&#39;)) {&lt;br /&gt;  return true;&lt;br /&gt; } else {&lt;br /&gt;  return false;&lt;br /&gt; } &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (isset($_POST) &amp;amp;&amp;amp; !empty($_POST)) {&lt;br /&gt; $to=&quot;bhardwajs.on.height@gmail.com&quot;;&lt;br /&gt; $subject=&quot;Test Local Mail on WebSpeaks&quot;;&lt;br /&gt; $message = $_POST[&#39;message&#39;];&lt;br /&gt; if (isset($_POST[&#39;send_text&#39;]) &amp;amp;&amp;amp; !empty($_POST[&#39;send_text&#39;])) {&lt;br /&gt;  mail($to, $subject, $message);&lt;br /&gt; } else {&lt;br /&gt;  $headers  = &#39;MIME-Version: 1.0&#39; . &quot;\r\n&quot;;&lt;br /&gt;  $headers .= &#39;Content-type: text/html; charset=iso-8859-1&#39; . &quot;\r\n&quot;;&lt;br /&gt;  mail($to, $subject, $message, $headers);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/8826243491717248819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-test-php-emails-on-localhost_08.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8826243491717248819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8826243491717248819'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-test-php-emails-on-localhost_08.html' title='How to Test PHP Emails on Localhost'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-7015001457096441133</id><published>2012-05-08T04:46:00.000-07:00</published><updated>2012-05-20T22:39:41.316-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="technology"/><category scheme="http://www.blogger.com/atom/ns#" term="tips n tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="webdesign"/><title type='text'>How to Test PHP Emails on Localhost</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;While developing web applications on localhost you must have always missed the functionality to send mails. As localhost does not support email service, so it has always been a bottleneck for email testing on localhost. But I have found a simple way to test emails on localhost using PHP. I have overridden the default &lt;span style=&quot;background-color: orange; color: white; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;mail()&lt;/span&gt; function of PHP to create a text/html file based on the email format. If the email is in html format, an HTML file is created otherwise a text file is created. You can see in this file what exactly is the content sent in your mail. &lt;a href=&quot;http://demos.webspeaks.in/localMail/&quot; target=&quot;_blank&quot;&gt;See how does it work&lt;/a&gt;.&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.webspeaks.in/localMail/&quot; target=&quot;_blank&quot;&gt;Live demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://demos.webspeaks.in/d/?f=localMail/localMail.zip&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;h2&gt;    Overriding the mail() function&lt;/h2&gt;To override the PHP mail() function, we need to create our namespace and then define the function in that namespace. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;#Create your own namespace&lt;br /&gt;namespace localMail;&lt;br /&gt;&lt;br /&gt;#Override the default mail function&lt;br /&gt;function mail( $to, $subject, $message, $additional_headers=&#39;&#39;, $additional_parameters=&#39;&#39; ) {&lt;br /&gt; if (empty($to) || empty($subject) || empty($message)) {&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Check if email is sent as HTML or plaintext&lt;br /&gt; if (isHTML($additional_headers)) {&lt;br /&gt;  $ext = &#39;html&#39;;&lt;br /&gt; }else{&lt;br /&gt;  $ext = &#39;txt&#39;;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Write the file&lt;br /&gt; $myFile = &quot;mail_&quot;.time().&quot;.&quot;.$ext;&lt;br /&gt; $fh = fopen($myFile, &#39;w&#39;) or die(&quot;can&#39;t open file&quot;);&lt;br /&gt; fwrite($fh, $message);&lt;br /&gt; fclose($fh);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Function to detect HTML headers&lt;br /&gt;function isHTML($isithtml) {&lt;br /&gt; if (strpos($isithtml, &#39;html&#39;)) {&lt;br /&gt;  return true;&lt;br /&gt; } else {&lt;br /&gt;  return false;&lt;br /&gt; } &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    Usage&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt; &amp;lt;title&amp;gt;Test Emails on localhost ! WebSpeaks.in&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt; &amp;lt;form method=&quot;post&quot; action=&quot;send_mail.php&quot;&amp;gt;&lt;br /&gt; &amp;lt;table align=&quot;center&quot;&amp;gt;&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td&amp;gt;&lt;br /&gt;    Type your message&amp;lt;br /&amp;gt;&lt;br /&gt;    &amp;lt;textarea name=&quot;message&quot; cols=&quot;50&quot; rows=&quot;5&quot;&amp;gt;&amp;lt;div style=&quot;color:#c3c;&quot;&amp;gt;This &amp;lt;i&amp;gt;email&amp;lt;/i&amp;gt; is &amp;lt;u&amp;gt;sent&amp;lt;/u&amp;gt; through &amp;lt;a href=&quot;#&quot;&amp;gt;localhost&amp;lt;/a&amp;gt;.&amp;lt;/div&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;/tr&amp;gt;&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td colspan=&quot;2&quot; align=&quot;right&quot;&amp;gt;&lt;br /&gt;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;send_text&quot; value=&quot;Send as Plain Text&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;send_html&quot; value=&quot;Send as HTML&quot; /&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;/tr&amp;gt;&lt;br /&gt; &amp;lt;/table&amp;gt;&lt;br /&gt; &amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    send_mail.php&lt;/h2&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;namespace localMail;&lt;br /&gt;#Override the default mail function&lt;br /&gt;function mail( $to, $subject, $message, $additional_headers=&#39;&#39;, $additional_parameters=&#39;&#39; ) {&lt;br /&gt; if (empty($to) || empty($subject) || empty($message)) {&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Check if email is sent as HTML or plaintext&lt;br /&gt; if (isHTML($additional_headers)) {&lt;br /&gt;  $ext = &#39;html&#39;;&lt;br /&gt; }else{&lt;br /&gt;  $ext = &#39;txt&#39;;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; #Write the file&lt;br /&gt; $myFile = &quot;mail_&quot;.time().&quot;.&quot;.$ext;&lt;br /&gt; $fh = fopen($myFile, &#39;w&#39;) or die(&quot;can&#39;t open file&quot;);&lt;br /&gt; fwrite($fh, $message);&lt;br /&gt; fclose($fh);&lt;br /&gt;&lt;br /&gt; header(&#39;Content-disposition: attachment; filename=&#39;.$myFile);&lt;br /&gt; if (isHTML($additional_headers)) {&lt;br /&gt;  header(&#39;Content-type: application/html&#39;);&lt;br /&gt; } else {&lt;br /&gt;  header(&#39;Content-type: application/text&#39;);&lt;br /&gt; }&lt;br /&gt; readfile($myFile);&lt;br /&gt; unlink($myFile);&lt;br /&gt; die();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Function to detect HTML headers&lt;br /&gt;function isHTML($isithtml) {&lt;br /&gt; if (strpos($isithtml, &#39;html&#39;)) {&lt;br /&gt;  return true;&lt;br /&gt; } else {&lt;br /&gt;  return false;&lt;br /&gt; } &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (isset($_POST) &amp;amp;&amp;amp; !empty($_POST)) {&lt;br /&gt; $to=&quot;bhardwajs.on.height@gmail.com&quot;;&lt;br /&gt; $subject=&quot;Test Local Mail on WebSpeaks&quot;;&lt;br /&gt; $message = $_POST[&#39;message&#39;];&lt;br /&gt; if (isset($_POST[&#39;send_text&#39;]) &amp;amp;&amp;amp; !empty($_POST[&#39;send_text&#39;])) {&lt;br /&gt;  mail($to, $subject, $message);&lt;br /&gt; } else {&lt;br /&gt;  $headers  = &#39;MIME-Version: 1.0&#39; . &quot;\r\n&quot;;&lt;br /&gt;  $headers .= &#39;Content-type: text/html; charset=iso-8859-1&#39; . &quot;\r\n&quot;;&lt;br /&gt;  mail($to, $subject, $message, $headers);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/7015001457096441133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-test-php-emails-on-localhost.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7015001457096441133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7015001457096441133'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/how-to-test-php-emails-on-localhost.html' title='How to Test PHP Emails on Localhost'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-8187367507302429735</id><published>2012-05-03T02:26:00.001-07:00</published><updated>2012-05-20T22:39:41.333-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="magento"/><category scheme="http://www.blogger.com/atom/ns#" term="magento-extension"/><category scheme="http://www.blogger.com/atom/ns#" term="technology"/><title type='text'>Magento Customer Chat Extension - Live Demo Released</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I have released the &lt;a href=&quot;http://chat.webspeaks.in/index.php/customer/account/login/&quot; target=&quot;_blank&quot;&gt;live demo&lt;/a&gt; of my &#39;Customer Chat&#39; extension for Magento. If you still dont know what this extension is, read &lt;a href=&quot;http://www.webspeaks.in/2011/12/magento-live-customer-chat-extension.html&quot;&gt;this article&lt;/a&gt;.&lt;br /&gt;Quick Overview:&amp;nbsp;Magento Customer Chat extension allows the customers on your store to communicate with each other in real time. The logged in customers on your store can see other logged in customers and chat with each other. The chat boxes are opened in Gmail style and new chat notifications are also shown over the browser window title bar.&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;a class=&quot;demo&quot; href=&quot;http://chat.webspeaks.in/index.php/customer/account/login/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;a href=&quot;http://www.webspeaks.in/2011/12/magento-live-customer-chat-extension.html&quot;&gt;Buy this Extension&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Demo Instructions:&lt;/b&gt;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Open &lt;a href=&quot;http://chat.webspeaks.in/index.php/customer/account/login/&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; page in two separate browsers.&lt;/li&gt;&lt;li&gt;Login with following test accounts:&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;User 1:&lt;/b&gt;&lt;br /&gt;Email:&amp;nbsp;user1@example.com&lt;br /&gt;Password: user123&lt;br /&gt;&lt;br /&gt;&lt;b&gt;User 2:&lt;/b&gt;&lt;br /&gt;Email: user2@example.com&lt;br /&gt;Password: userxyz&lt;br /&gt;&lt;br /&gt;Then start sending messages to each other...&lt;br /&gt;&lt;br /&gt;Here are the features available in the extension:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;See all online users&amp;nbsp;&lt;/li&gt;&lt;li&gt;Chat with any online user&lt;/li&gt;&lt;li&gt;New chat notification&lt;/li&gt;&lt;li&gt;Option to configure the chat timing and the chatbox colors&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/8187367507302429735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/magento-customer-chat-extension-live_03.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8187367507302429735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8187367507302429735'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/magento-customer-chat-extension-live_03.html' title='Magento Customer Chat Extension - Live Demo Released'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-7867301472540954301</id><published>2012-05-03T02:26:00.000-07:00</published><updated>2012-05-20T22:39:41.327-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="magento"/><category scheme="http://www.blogger.com/atom/ns#" term="magento-extension"/><category scheme="http://www.blogger.com/atom/ns#" term="technology"/><title type='text'>Magento Customer Chat Extension - Live Demo Released</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I have released the &lt;a href=&quot;http://chat.webspeaks.in/index.php/customer/account/login/&quot; target=&quot;_blank&quot;&gt;live demo&lt;/a&gt; of my &#39;Customer Chat&#39; extension for Magento. If you still dont know what this extension is, read &lt;a href=&quot;http://www.webspeaks.in/2011/12/magento-live-customer-chat-extension.html&quot;&gt;this article&lt;/a&gt;.&lt;br /&gt;Quick Overview:&amp;nbsp;Magento Customer Chat extension allows the customers on your store to communicate with each other in real time. The logged in customers on your store can see other logged in customers and chat with each other. The chat boxes are opened in Gmail style and new chat notifications are also shown over the browser window title bar.&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;a class=&quot;demo&quot; href=&quot;http://chat.webspeaks.in/index.php/customer/account/login/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;a href=&quot;http://www.webspeaks.in/2011/12/magento-live-customer-chat-extension.html&quot;&gt;Buy this Extension&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Demo Instructions:&lt;/b&gt;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Open &lt;a href=&quot;http://chat.webspeaks.in/index.php/customer/account/login/&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; page in two separate browsers.&lt;/li&gt;&lt;li&gt;Login with following test accounts:&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;User 1:&lt;/b&gt;&lt;br /&gt;Email:&amp;nbsp;user1@example.com&lt;br /&gt;Password: user123&lt;br /&gt;&lt;br /&gt;&lt;b&gt;User 2:&lt;/b&gt;&lt;br /&gt;Email: user2@example.com&lt;br /&gt;Password: userxyz&lt;br /&gt;&lt;br /&gt;Then start sending messages to each other...&lt;br /&gt;&lt;br /&gt;Here are the features available in the extension:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;See all online users&amp;nbsp;&lt;/li&gt;&lt;li&gt;Chat with any online user&lt;/li&gt;&lt;li&gt;New chat notification&lt;/li&gt;&lt;li&gt;Option to configure the chat timing and the chatbox colors&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/7867301472540954301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/magento-customer-chat-extension-live.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7867301472540954301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7867301472540954301'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/magento-customer-chat-extension-live.html' title='Magento Customer Chat Extension - Live Demo Released'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-2710739117387003313</id><published>2012-05-02T10:45:00.001-07:00</published><updated>2012-05-20T22:39:41.269-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="magento"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="tips n tricks"/><title type='text'>Add/Update Attribute Option Values Programmatically in Magento</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Adding/Updating the attribute option values programmatically in Magento can be tedious sometimes. Adding attribute options through custom codes is not big deal but updating the values for already added attribute options is tricky enough.&lt;br /&gt;&lt;b&gt;Problem:&lt;/b&gt;Lets understand this by an example. Suppose we have a product attribute &#39;manufacturer&#39;. It is of type select/dropdown. And we have few options added in it like Mac, Google, Android etc. Now at some point in our Magento application we want to update these options with Apple, Nexus, HTC etc without using the admin panel, then it is a problem.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKL-c2e127ARQ8xEmbsznSWB5KPNjaAjRhNZ9RWsGbDPm4ew2GovFifC4VH3-zlEIeHMwPa0rl7fCNFw9x7b4JWUFF-AktYBJAq0QJXp66TjrNUZAIJRYqKjwL1DSZafRzqVfDC9L3F06/s1600/manufacturer+-+Before+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-11-20.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKL-c2e127ARQ8xEmbsznSWB5KPNjaAjRhNZ9RWsGbDPm4ew2GovFifC4VH3-zlEIeHMwPa0rl7fCNFw9x7b4JWUFF-AktYBJAq0QJXp66TjrNUZAIJRYqKjwL1DSZafRzqVfDC9L3F06/s1600/manufacturer+-+Before+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-11-20.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution:&lt;/b&gt;To update the option values programmatically, I came up with a simple solution which is as follows. For this, you need to find the &#39;option_id&#39; of the attribute options in the &#39;eav_attribute_option_value&#39; table.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjykUP8Nwk49AEdnqM9b6IcAAh9JjQU6LEIAJwEJFjf5E9g0QGCjmXK044UBD-MJAQspbxaFYG6sLZgUgqtaH9Iy_KeN0dd8dZLf406zRC3xzp6-lAL_tH-Jrmayr55KYyW0LH1txGbcubU/s1600/option_ids.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjykUP8Nwk49AEdnqM9b6IcAAh9JjQU6LEIAJwEJFjf5E9g0QGCjmXK044UBD-MJAQspbxaFYG6sLZgUgqtaH9Iy_KeN0dd8dZLf406zRC3xzp6-lAL_tH-Jrmayr55KYyW0LH1txGbcubU/s1600/option_ids.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Then create an option array and save it in the appropriate model.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDe4q8cULuD2kNQFnBKSjTQr0iSriMSU9sUGZzRgEXwjciWqHxLPDLC4DJbsC2il19fbQ0UVotmoqxPqef1rIoNd73BoJIil5dQCLBgzf04oak2FsziwQ5GF9b6MRPiBrzYS4bOhV2pgWo/s1600/manufacturer+-+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-13-08.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDe4q8cULuD2kNQFnBKSjTQr0iSriMSU9sUGZzRgEXwjciWqHxLPDLC4DJbsC2il19fbQ0UVotmoqxPqef1rIoNd73BoJIil5dQCLBgzf04oak2FsziwQ5GF9b6MRPiBrzYS4bOhV2pgWo/s1600/manufacturer+-+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-13-08.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt; Updating Attribute options&lt;/h2&gt;&lt;pre class=&quot;brush:php&quot;&gt;//Get the eav attribute model&lt;br /&gt;$attr_model = Mage::getModel(&#39;catalog/resource_eav_attribute&#39;);&lt;br /&gt;&lt;br /&gt;//Load the particular attribute by id&lt;br /&gt;//Here 73 is the id of &#39;manufacturer&#39; attribute&lt;br /&gt;$attr_model-&amp;gt;load(73);&lt;br /&gt;&lt;br /&gt;//Create an array to store the attribute data&lt;br /&gt;$data = array();&lt;br /&gt;&lt;br /&gt;//Create options array&lt;br /&gt;$values = array(&lt;br /&gt; //15 is the option_id of the option in &#39;eav_attribute_option_value&#39; table&lt;br /&gt; 15 =&amp;gt; array(&lt;br /&gt;   0 =&amp;gt; &#39;Apple&#39; //0 is current store id, Apple is the new label for the option&lt;br /&gt;  ),&lt;br /&gt; 19 =&amp;gt; array(&lt;br /&gt;   0 =&amp;gt; &#39;Nexus&#39;&lt;br /&gt;  ),&lt;br /&gt; 12 =&amp;gt; array(&lt;br /&gt;   0 =&amp;gt; &#39;HTC&#39;&lt;br /&gt;  ),&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//Add the option values to the data&lt;br /&gt;$data[&#39;option&#39;][&#39;value&#39;] = $values;&lt;br /&gt;&lt;br /&gt;//Add data to our attribute model&lt;br /&gt;$attr_model-&amp;gt;addData($data);&lt;br /&gt;&lt;br /&gt;//Save the updated model&lt;br /&gt;try {&lt;br /&gt; $attr_model-&amp;gt;save();&lt;br /&gt; $session = Mage::getSingleton(&#39;adminhtml/session&#39;);&lt;br /&gt; $session-&amp;gt;addSuccess(&lt;br /&gt;  Mage::helper(&#39;catalog&#39;)-&amp;gt;__(&#39;The product attribute has been saved.&#39;));&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Clear translation cache because attribute labels are stored in translation&lt;br /&gt;  */&lt;br /&gt; Mage::app()-&amp;gt;cleanCache(array(Mage_Core_Model_Translate::CACHE_TAG));&lt;br /&gt; $session-&amp;gt;setAttributeData(false);&lt;br /&gt; return;&lt;br /&gt;} catch (Exception $e) {&lt;br /&gt; $session-&amp;gt;addError($e-&amp;gt;getMessage());&lt;br /&gt; $session-&amp;gt;setAttributeData($data);&lt;br /&gt; return;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;This is all and you are done.  &lt;br /&gt;&lt;h2&gt;   Adding new Attribute option&lt;/h2&gt;&lt;pre class=&quot;brush:php&quot;&gt;$arg_attribute = &#39;manufacturer&#39;;&lt;br /&gt;$arg_value = &#39;value to be added&#39;;&lt;br /&gt;&lt;br /&gt;$attr_model = Mage::getModel(&#39;catalog/resource_eav_attribute&#39;);&lt;br /&gt;$attr = $attr_model-&amp;gt;loadByCode(&#39;catalog_product&#39;, $arg_attribute);&lt;br /&gt;$attr_id = $attr-&amp;gt;getAttributeId();&lt;br /&gt;&lt;br /&gt;$option[&#39;attribute_id&#39;] = $attr_id;&lt;br /&gt;$option[&#39;value&#39;][&#39;any_option_name&#39;][0] = $arg_value;&lt;br /&gt;&lt;br /&gt;$setup = new Mage_Eav_Model_Entity_Setup(&#39;core_setup&#39;);&lt;br /&gt;$setup-&amp;gt;addAttributeOption($option);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/2710739117387003313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/addupdate-attribute-option-values_02.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/2710739117387003313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/2710739117387003313'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/addupdate-attribute-option-values_02.html' title='Add/Update Attribute Option Values Programmatically in Magento'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKL-c2e127ARQ8xEmbsznSWB5KPNjaAjRhNZ9RWsGbDPm4ew2GovFifC4VH3-zlEIeHMwPa0rl7fCNFw9x7b4JWUFF-AktYBJAq0QJXp66TjrNUZAIJRYqKjwL1DSZafRzqVfDC9L3F06/s72-c/manufacturer+-+Before+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-11-20.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-4767267499442265243</id><published>2012-05-02T10:45:00.000-07:00</published><updated>2012-05-20T22:39:41.288-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="magento"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="tips n tricks"/><title type='text'>Add/Update Attribute Option Values Programmatically in Magento</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Adding/Updating the attribute option values programmatically in Magento can be tedious sometimes. Adding attribute options through custom codes is not big deal but updating the values for already added attribute options is tricky enough.&lt;br /&gt;&lt;b&gt;Problem:&lt;/b&gt;Lets understand this by an example. Suppose we have a product attribute &#39;manufacturer&#39;. It is of type select/dropdown. And we have few options added in it like Mac, Google, Android etc. Now at some point in our Magento application we want to update these options with Apple, Nexus, HTC etc without using the admin panel, then it is a problem.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKL-c2e127ARQ8xEmbsznSWB5KPNjaAjRhNZ9RWsGbDPm4ew2GovFifC4VH3-zlEIeHMwPa0rl7fCNFw9x7b4JWUFF-AktYBJAq0QJXp66TjrNUZAIJRYqKjwL1DSZafRzqVfDC9L3F06/s1600/manufacturer+-+Before+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-11-20.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKL-c2e127ARQ8xEmbsznSWB5KPNjaAjRhNZ9RWsGbDPm4ew2GovFifC4VH3-zlEIeHMwPa0rl7fCNFw9x7b4JWUFF-AktYBJAq0QJXp66TjrNUZAIJRYqKjwL1DSZafRzqVfDC9L3F06/s1600/manufacturer+-+Before+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-11-20.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution:&lt;/b&gt;To update the option values programmatically, I came up with a simple solution which is as follows. For this, you need to find the &#39;option_id&#39; of the attribute options in the &#39;eav_attribute_option_value&#39; table.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjykUP8Nwk49AEdnqM9b6IcAAh9JjQU6LEIAJwEJFjf5E9g0QGCjmXK044UBD-MJAQspbxaFYG6sLZgUgqtaH9Iy_KeN0dd8dZLf406zRC3xzp6-lAL_tH-Jrmayr55KYyW0LH1txGbcubU/s1600/option_ids.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjykUP8Nwk49AEdnqM9b6IcAAh9JjQU6LEIAJwEJFjf5E9g0QGCjmXK044UBD-MJAQspbxaFYG6sLZgUgqtaH9Iy_KeN0dd8dZLf406zRC3xzp6-lAL_tH-Jrmayr55KYyW0LH1txGbcubU/s1600/option_ids.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Then create an option array and save it in the appropriate model.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDe4q8cULuD2kNQFnBKSjTQr0iSriMSU9sUGZzRgEXwjciWqHxLPDLC4DJbsC2il19fbQ0UVotmoqxPqef1rIoNd73BoJIil5dQCLBgzf04oak2FsziwQ5GF9b6MRPiBrzYS4bOhV2pgWo/s1600/manufacturer+-+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-13-08.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDe4q8cULuD2kNQFnBKSjTQr0iSriMSU9sUGZzRgEXwjciWqHxLPDLC4DJbsC2il19fbQ0UVotmoqxPqef1rIoNd73BoJIil5dQCLBgzf04oak2FsziwQ5GF9b6MRPiBrzYS4bOhV2pgWo/s1600/manufacturer+-+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-13-08.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt; Updating Attribute options&lt;/h2&gt;&lt;pre class=&quot;brush:php&quot;&gt;//Get the eav attribute model&lt;br /&gt;$attr_model = Mage::getModel(&#39;catalog/resource_eav_attribute&#39;);&lt;br /&gt;&lt;br /&gt;//Load the particular attribute by id&lt;br /&gt;//Here 73 is the id of &#39;manufacturer&#39; attribute&lt;br /&gt;$attr_model-&amp;gt;load(73);&lt;br /&gt;&lt;br /&gt;//Create an array to store the attribute data&lt;br /&gt;$data = array();&lt;br /&gt;&lt;br /&gt;//Create options array&lt;br /&gt;$values = array(&lt;br /&gt; //15 is the option_id of the option in &#39;eav_attribute_option_value&#39; table&lt;br /&gt; 15 =&amp;gt; array(&lt;br /&gt;   0 =&amp;gt; &#39;Apple&#39; //0 is current store id, Apple is the new label for the option&lt;br /&gt;  ),&lt;br /&gt; 19 =&amp;gt; array(&lt;br /&gt;   0 =&amp;gt; &#39;Nexus&#39;&lt;br /&gt;  ),&lt;br /&gt; 12 =&amp;gt; array(&lt;br /&gt;   0 =&amp;gt; &#39;HTC&#39;&lt;br /&gt;  ),&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//Add the option values to the data&lt;br /&gt;$data[&#39;option&#39;][&#39;value&#39;] = $values;&lt;br /&gt;&lt;br /&gt;//Add data to our attribute model&lt;br /&gt;$attr_model-&amp;gt;addData($data);&lt;br /&gt;&lt;br /&gt;//Save the updated model&lt;br /&gt;try {&lt;br /&gt; $attr_model-&amp;gt;save();&lt;br /&gt; $session = Mage::getSingleton(&#39;adminhtml/session&#39;);&lt;br /&gt; $session-&amp;gt;addSuccess(&lt;br /&gt;  Mage::helper(&#39;catalog&#39;)-&amp;gt;__(&#39;The product attribute has been saved.&#39;));&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Clear translation cache because attribute labels are stored in translation&lt;br /&gt;  */&lt;br /&gt; Mage::app()-&amp;gt;cleanCache(array(Mage_Core_Model_Translate::CACHE_TAG));&lt;br /&gt; $session-&amp;gt;setAttributeData(false);&lt;br /&gt; return;&lt;br /&gt;} catch (Exception $e) {&lt;br /&gt; $session-&amp;gt;addError($e-&amp;gt;getMessage());&lt;br /&gt; $session-&amp;gt;setAttributeData($data);&lt;br /&gt; return;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;This is all and you are done.  &lt;br /&gt;&lt;h2&gt;   Adding new Attribute option&lt;/h2&gt;&lt;pre class=&quot;brush:php&quot;&gt;$arg_attribute = &#39;manufacturer&#39;;&lt;br /&gt;$arg_value = &#39;value to be added&#39;;&lt;br /&gt;&lt;br /&gt;$attr_model = Mage::getModel(&#39;catalog/resource_eav_attribute&#39;);&lt;br /&gt;$attr = $attr_model-&amp;gt;loadByCode(&#39;catalog_product&#39;, $arg_attribute);&lt;br /&gt;$attr_id = $attr-&amp;gt;getAttributeId();&lt;br /&gt;&lt;br /&gt;$option[&#39;attribute_id&#39;] = $attr_id;&lt;br /&gt;$option[&#39;value&#39;][&#39;any_option_name&#39;][0] = $arg_value;&lt;br /&gt;&lt;br /&gt;$setup = new Mage_Eav_Model_Entity_Setup(&#39;core_setup&#39;);&lt;br /&gt;$setup-&amp;gt;addAttributeOption($option);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/4767267499442265243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/05/addupdate-attribute-option-values.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/4767267499442265243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/4767267499442265243'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/05/addupdate-attribute-option-values.html' title='Add/Update Attribute Option Values Programmatically in Magento'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYKL-c2e127ARQ8xEmbsznSWB5KPNjaAjRhNZ9RWsGbDPm4ew2GovFifC4VH3-zlEIeHMwPa0rl7fCNFw9x7b4JWUFF-AktYBJAq0QJXp66TjrNUZAIJRYqKjwL1DSZafRzqVfDC9L3F06/s72-c/manufacturer+-+Before+Manage+Attributes+-+Attributes+-+Catalog+-+Magento+Admin+2012-05-02+23-11-20.png" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-5632624247825745086</id><published>2012-04-18T04:17:00.001-07:00</published><updated>2012-05-20T22:39:41.295-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="twitter"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><category scheme="http://www.blogger.com/atom/ns#" term="webdesign"/><category scheme="http://www.blogger.com/atom/ns#" term="webservice"/><title type='text'>Twitter like Real Time Wall Update Using Pusher API and jQuery</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If you have ever dreamt of showing real time data on your website then this tutorial is for you. In this tutorial I will show you how to show real time updates and data on you web pages. Here I will use &lt;a href=&quot;http://pusher.com/&quot; target=&quot;_blank&quot;&gt;Pusher&lt;/a&gt; API to create a two way communication between the client and server. The &lt;a href=&quot;http://pusher.com/&quot; target=&quot;_blank&quot;&gt;Pusher&lt;/a&gt; API uses websockets for the two way communication and its free for starting your development.&lt;br /&gt;Here I have created a Twitter/Facebook style real time updating wall script that will display the status updates of the users in real time. I have used the excellent twitter wall layout by Srinivas Tamada from &lt;a href=&quot;http://www.blogger.com/www.9lessons.info/2010/10/new-twitter-design-css-jquery.html&quot; target=&quot;_blank&quot;&gt;9lessons&lt;/a&gt;. &lt;a href=&quot;http://demos.webspeaks.in/realtime/&quot; target=&quot;_blank&quot;&gt;See the live demo&lt;/a&gt;.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSXfR_S8blOgi0zjAKvknKPGGTRAFwEjNIdzbMCfgTVkTfu-3_yykk5ZZ1JjG9mBbCHYwJwj1mWycp7bwIMqROtAoGmVt8FvVwN3yXXj478O-SqoEywu07yxcc_ImJM1NT3O_zX25rxDM/s1600/Twitter+like+real+time+wall+update+using+Pusher+API+-+WebSpeaks+2012-04-18+16-35-14.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSXfR_S8blOgi0zjAKvknKPGGTRAFwEjNIdzbMCfgTVkTfu-3_yykk5ZZ1JjG9mBbCHYwJwj1mWycp7bwIMqROtAoGmVt8FvVwN3yXXj478O-SqoEywu07yxcc_ImJM1NT3O_zX25rxDM/s400/Twitter+like+real+time+wall+update+using+Pusher+API+-+WebSpeaks+2012-04-18+16-35-14.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For the exact effect, open the demo page in two browsers and check them simultaneously.&lt;br /&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.webspeaks.in/realtime/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://www.box.com/s/18f55a85a483d53c48b8&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;h2&gt;       1. The HTML Layout&lt;/h2&gt;We have included the jQuery library, then Pusher library and our javascript and style.css. &lt;br /&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt; &lt;br /&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt; &lt;br /&gt;&amp;lt;head&amp;gt; &lt;br /&gt;&amp;lt;link href=&quot;style.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;http://js.pusher.com/1.11/pusher.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;script.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt; &amp;lt;div id=&#39;container&#39;&amp;gt;&lt;br /&gt;  &amp;lt;div id=&quot;header&quot;&amp;gt;&lt;br /&gt;   &amp;lt;textarea cols=&quot;80&quot; rows=&quot;2&quot; class=&quot;t_area&quot; id=&quot;status&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br /&gt;   &amp;lt;br /&amp;gt;&lt;br /&gt;   &amp;lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; class=&quot;t_box&quot; /&amp;gt;&lt;br /&gt;   &amp;lt;input type=&quot;button&quot; class=&quot;btn&quot; id=&quot;update_btn&quot; value=&quot;Update&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class=&#39;right&#39;&amp;gt;&lt;br /&gt;   &amp;lt;h4&amp;gt;This tutorial shows you how to create Twitter/Facebook like real time wall updates using Pusher API and jQuery. This tutorial &amp;lt;a href=&#39;http://www.webspeaks.in/2012/04/twitter-like-real-time-wall-update.html&#39; style=&#39;color:#cc0000&#39;&amp;gt;click here&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt; &lt;br /&gt;  &amp;lt;/div&amp;gt; &lt;br /&gt;  &amp;lt;div id=&quot;panel-frame&quot;&amp;gt; &lt;br /&gt;   &amp;lt;div class=&quot;panel&quot;&amp;gt; &lt;br /&gt;    &amp;lt;div class=&quot;head&quot;&amp;gt; &lt;br /&gt;     &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;Close&amp;lt;/a&amp;gt; &lt;br /&gt;    &amp;lt;/div&amp;gt; &lt;br /&gt;    &amp;lt;div class=&quot;data&quot; style=&quot;padding:20px&quot;&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;   &amp;lt;/div&amp;gt; &lt;br /&gt;  &amp;lt;/div&amp;gt; &lt;br /&gt;&lt;br /&gt;  &amp;lt;div class=&quot;left&quot;&amp;gt; &lt;br /&gt;   &amp;lt;div class=&quot;block&quot; id=&quot;1&quot;&amp;gt;Test message&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt; &lt;br /&gt;&amp;lt;/body&amp;gt; &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       2. Initializing Pusher Object&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;var pusher = new Pusher(&#39;352cb21a5ef3e5d8e0fe&#39;); //This is your app key&lt;br /&gt;&lt;br /&gt;//channel is the medium for the communication&lt;br /&gt;var ws_channel = pusher.subscribe(&#39;ws_channel&#39;); //you can create any channel&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       3. Sending data to server&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;$(&#39;#update_btn&#39;).click(function(){&lt;br /&gt; var status = jQuery.trim(jQuery(&#39;#status&#39;).val()); //get the status&lt;br /&gt; var username = jQuery.trim(jQuery(&#39;#username&#39;).val()); get the username&lt;br /&gt; if(status == &#39;&#39;){&lt;br /&gt;  alert(&#39;Please enter your message.&#39;);&lt;br /&gt;  jQuery(&#39;#status&#39;).focus();&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt; if(username == &#39;&#39;){&lt;br /&gt;  alert(&#39;Please enter your username.&#39;);&lt;br /&gt;  jQuery(&#39;#username&#39;).focus();&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; //make ajax call to the server&lt;br /&gt; $.ajax({&lt;br /&gt;  type : &quot;POST&quot;,&lt;br /&gt;  url : &#39;send_update.php&#39;,&lt;br /&gt;  dataType : &quot;json&quot;,&lt;br /&gt;  data: { update : status, username : username },&lt;br /&gt;  beforeSend: function(){&lt;br /&gt;   jQuery(&#39;#update_btn&#39;).val(&#39;Updating...&#39;);&lt;br /&gt;  },&lt;br /&gt;  success : function(msg) {&lt;br /&gt;   if( msg.success ) {&lt;br /&gt;    //do nothing&lt;br /&gt;   } else {&lt;br /&gt;    //alert(msg.errormsg);&lt;br /&gt;   }&lt;br /&gt;   jQuery(&#39;#update_btn&#39;).val(&#39;Update&#39;);&lt;br /&gt;  },&lt;br /&gt;  error: function(msg) {&lt;br /&gt;  }&lt;br /&gt; });&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       4. Create send_update.php&lt;/h2&gt;Note that we have created &#39;new_update&#39; event in this file. This event is fired when the status update takes place and it can be used in the JavaScript code on client side like any other event. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;//include the pusher publisher library&lt;br /&gt;include_once &#39;Pusher.php&#39;;&lt;br /&gt;&lt;br /&gt;$pusher = new Pusher(&lt;br /&gt; &#39;352cb21a5ef3e5d8e0fe&#39;, //APP KEY&lt;br /&gt; &#39;88cbaa5abd8c8d8d7fa9&#39;, //APP SECRET&lt;br /&gt; &#39;18728&#39; //APP ID&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//get the message posted by our ajax call&lt;br /&gt;$update = $_POST[&#39;update&#39;];&lt;br /&gt;$username = $_POST[&#39;username&#39;];&lt;br /&gt;&lt;br /&gt;//trim it&lt;br /&gt;$update = trim($update);&lt;br /&gt;$username = trim($username);&lt;br /&gt;&lt;br /&gt;$message = &quot;{$update} &amp;lt;span class=&#39;username&#39;&amp;gt;@{$username}&amp;lt;/span&amp;gt; &amp;lt;span class=&#39;time&#39;&amp;gt; &quot;.date(&#39;Y-m-d H:i:s&#39;).&#39;&amp;lt;/time&amp;gt;&#39;;&lt;br /&gt;&lt;br /&gt;//trigger the &#39;new_update&#39; event in our channel, &#39;ws_channel&#39;&lt;br /&gt;$pusher-&amp;gt;trigger(&lt;br /&gt; &#39;ws_channel&#39;, //the channel&lt;br /&gt; &#39;new_update&#39;, //the event&lt;br /&gt; array(&#39;update&#39; =&amp;gt; $message) //the data to send&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//to be returned to our ajax call&lt;br /&gt;echo json_encode(array(&lt;br /&gt; &#39;update&#39; =&amp;gt; $message,&lt;br /&gt; &#39;success&#39; =&amp;gt; true&lt;br /&gt;));&lt;br /&gt;exit();&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       5. Bind the event in client side JavaScript&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;//new_update was triggered in send_update.php&lt;br /&gt;//bind our update code with new_update event&lt;br /&gt;ws_channel.bind(&#39;new_update&#39;, function(data) {&lt;br /&gt; update_wall(data);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;//this function performs the update&lt;br /&gt;function update_wall(data) {&lt;br /&gt; var parent = $(&#39;div.left&#39;);&lt;br /&gt; var len = parent.find(&#39;div.block&#39;).length;&lt;br /&gt; var htm = &#39;&amp;lt;div class=&quot;block&quot; id=&quot;&#39;+len+&#39;&quot;&amp;gt;&#39;+ data.update +&#39;&amp;lt;/div&amp;gt;&#39;;&lt;br /&gt; parent.prepend(htm);&lt;br /&gt; jQuery(&#39;#status&#39;).val(&#39;&#39;);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       6. Show the twitter style detail window&lt;/h2&gt;This code has been borrowed from Srinivas Tamada at &lt;a href=&quot;http://www.blogger.com/www.9lessons.info/2010/10/new-twitter-design-css-jquery.html&quot; target=&quot;_blank&quot;&gt;9lessons&lt;/a&gt;. &lt;br /&gt;&lt;pre class=&quot;brush:js&quot;&gt;$(&#39;.block&#39;).live(&#39;click&#39;, function(){&lt;br /&gt; var id= $(this).attr(&#39;id&#39;);&lt;br /&gt; var text = $(this).html();&lt;br /&gt; var data_id= $(&quot;.data&quot;).html();&lt;br /&gt; var panel= $(&#39;.panel&#39;);&lt;br /&gt; var panel_width=$(&#39;.panel&#39;).css(&#39;left&#39;);&lt;br /&gt; if(data_id==id){&lt;br /&gt;  panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt; }else{&lt;br /&gt;  if(panel_width==&#39;341px&#39;){&lt;br /&gt;&lt;br /&gt;  }else{&lt;br /&gt;   panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; $(&#39;.data&#39;).html(text);&lt;br /&gt; return false;&lt;br /&gt;});&lt;br /&gt;$(&#39;.close&#39;).click(function(){&lt;br /&gt; var panel= $(&#39;.panel&#39;);&lt;br /&gt; panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt; return false;&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       7. Complete JavaScript Code&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;var pusher = new Pusher(&#39;352cb21a5ef3e5d8e0fe&#39;);&lt;br /&gt;var ws_channel = pusher.subscribe(&#39;ws_channel&#39;); //join the ws_channel channel&lt;br /&gt;&lt;br /&gt;$(document).ready(function() {&lt;br /&gt; $(&#39;.block&#39;).live(&#39;click&#39;, function(){&lt;br /&gt;  var id= $(this).attr(&#39;id&#39;);&lt;br /&gt;  var text = $(this).html();&lt;br /&gt;  var data_id= $(&quot;.data&quot;).html();&lt;br /&gt;  var panel= $(&#39;.panel&#39;);&lt;br /&gt;  var panel_width=$(&#39;.panel&#39;).css(&#39;left&#39;);&lt;br /&gt;  if(data_id==id){&lt;br /&gt;   panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;  }else{&lt;br /&gt;   if(panel_width==&#39;341px&#39;){&lt;br /&gt;&lt;br /&gt;   }else{&lt;br /&gt;    panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  $(&#39;.data&#39;).html(text);&lt;br /&gt;  return false;&lt;br /&gt; });&lt;br /&gt; $(&#39;.close&#39;).click(function(){&lt;br /&gt;  var panel= $(&#39;.panel&#39;);&lt;br /&gt;  panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;  return false;&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt; function update_wall(data) {&lt;br /&gt;  var parent = $(&#39;div.left&#39;);&lt;br /&gt;  var len = parent.find(&#39;div.block&#39;).length;&lt;br /&gt;  var htm = &#39;&amp;lt;div class=&quot;block&quot; id=&quot;&#39;+len+&#39;&quot;&amp;gt;&#39;+ data.update +&#39;&amp;lt;/div&amp;gt;&#39;;&lt;br /&gt;  parent.prepend(htm);&lt;br /&gt;  jQuery(&#39;#status&#39;).val(&#39;&#39;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; ws_channel.bind(&#39;new_update&#39;, function(data) {&lt;br /&gt;  update_wall(data);&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt; $(&#39;#update_btn&#39;).click(function(){&lt;br /&gt;  var status = jQuery.trim(jQuery(&#39;#status&#39;).val());&lt;br /&gt;  var username = jQuery.trim(jQuery(&#39;#username&#39;).val());&lt;br /&gt;  if(status == &#39;&#39;){&lt;br /&gt;   alert(&#39;Please enter your message.&#39;);&lt;br /&gt;   jQuery(&#39;#status&#39;).focus();&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  if(username == &#39;&#39;){&lt;br /&gt;   alert(&#39;Please enter your username.&#39;);&lt;br /&gt;   jQuery(&#39;#username&#39;).focus();&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  $.ajax({&lt;br /&gt;   type : &quot;POST&quot;,&lt;br /&gt;   url : &#39;send_update.php&#39;,&lt;br /&gt;   dataType : &quot;json&quot;,&lt;br /&gt;   data: { update : status, username : username },&lt;br /&gt;   beforeSend: function(){&lt;br /&gt;    jQuery(&#39;#update_btn&#39;).val(&#39;Updating...&#39;);&lt;br /&gt;   },&lt;br /&gt;   success : function(msg) {&lt;br /&gt;    if( msg.success ) {&lt;br /&gt;     //do nothing&lt;br /&gt;    } else {&lt;br /&gt;     //alert(msg.errormsg);&lt;br /&gt;    }&lt;br /&gt;    jQuery(&#39;#update_btn&#39;).val(&#39;Update&#39;);&lt;br /&gt;   },&lt;br /&gt;   error: function(msg) {&lt;br /&gt;   }&lt;br /&gt;  });&lt;br /&gt; });&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/5632624247825745086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/04/twitter-like-real-time-wall-update_18.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/5632624247825745086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/5632624247825745086'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/04/twitter-like-real-time-wall-update_18.html' title='Twitter like Real Time Wall Update Using Pusher API and jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSXfR_S8blOgi0zjAKvknKPGGTRAFwEjNIdzbMCfgTVkTfu-3_yykk5ZZ1JjG9mBbCHYwJwj1mWycp7bwIMqROtAoGmVt8FvVwN3yXXj478O-SqoEywu07yxcc_ImJM1NT3O_zX25rxDM/s72-c/Twitter+like+real+time+wall+update+using+Pusher+API+-+WebSpeaks+2012-04-18+16-35-14.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-2309815622380569900</id><published>2012-04-18T04:17:00.000-07:00</published><updated>2012-05-20T22:39:41.263-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="twitter"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><category scheme="http://www.blogger.com/atom/ns#" term="webdesign"/><category scheme="http://www.blogger.com/atom/ns#" term="webservice"/><title type='text'>Twitter like Real Time Wall Update Using Pusher API and jQuery</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If you have ever dreamt of showing real time data on your website then this tutorial is for you. In this tutorial I will show you how to show real time updates and data on you web pages. Here I will use &lt;a href=&quot;http://pusher.com/&quot; target=&quot;_blank&quot;&gt;Pusher&lt;/a&gt; API to create a two way communication between the client and server. The &lt;a href=&quot;http://pusher.com/&quot; target=&quot;_blank&quot;&gt;Pusher&lt;/a&gt; API uses websockets for the two way communication and its free for starting your development.&lt;br /&gt;Here I have created a Twitter/Facebook style real time updating wall script that will display the status updates of the users in real time. I have used the excellent twitter wall layout by Srinivas Tamada from &lt;a href=&quot;http://www.blogger.com/www.9lessons.info/2010/10/new-twitter-design-css-jquery.html&quot; target=&quot;_blank&quot;&gt;9lessons&lt;/a&gt;. &lt;a href=&quot;http://demos.webspeaks.in/realtime/&quot; target=&quot;_blank&quot;&gt;See the live demo&lt;/a&gt;.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSXfR_S8blOgi0zjAKvknKPGGTRAFwEjNIdzbMCfgTVkTfu-3_yykk5ZZ1JjG9mBbCHYwJwj1mWycp7bwIMqROtAoGmVt8FvVwN3yXXj478O-SqoEywu07yxcc_ImJM1NT3O_zX25rxDM/s1600/Twitter+like+real+time+wall+update+using+Pusher+API+-+WebSpeaks+2012-04-18+16-35-14.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSXfR_S8blOgi0zjAKvknKPGGTRAFwEjNIdzbMCfgTVkTfu-3_yykk5ZZ1JjG9mBbCHYwJwj1mWycp7bwIMqROtAoGmVt8FvVwN3yXXj478O-SqoEywu07yxcc_ImJM1NT3O_zX25rxDM/s400/Twitter+like+real+time+wall+update+using+Pusher+API+-+WebSpeaks+2012-04-18+16-35-14.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For the exact effect, open the demo page in two browsers and check them simultaneously.&lt;br /&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.webspeaks.in/realtime/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://www.box.com/s/18f55a85a483d53c48b8&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;h2&gt;       1. The HTML Layout&lt;/h2&gt;We have included the jQuery library, then Pusher library and our javascript and style.css. &lt;br /&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt; &lt;br /&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt; &lt;br /&gt;&amp;lt;head&amp;gt; &lt;br /&gt;&amp;lt;link href=&quot;style.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&amp;gt;&lt;br /&gt;&amp;lt;script src=&quot;http://js.pusher.com/1.11/pusher.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;script.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt; &amp;lt;div id=&#39;container&#39;&amp;gt;&lt;br /&gt;  &amp;lt;div id=&quot;header&quot;&amp;gt;&lt;br /&gt;   &amp;lt;textarea cols=&quot;80&quot; rows=&quot;2&quot; class=&quot;t_area&quot; id=&quot;status&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br /&gt;   &amp;lt;br /&amp;gt;&lt;br /&gt;   &amp;lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; class=&quot;t_box&quot; /&amp;gt;&lt;br /&gt;   &amp;lt;input type=&quot;button&quot; class=&quot;btn&quot; id=&quot;update_btn&quot; value=&quot;Update&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class=&#39;right&#39;&amp;gt;&lt;br /&gt;   &amp;lt;h4&amp;gt;This tutorial shows you how to create Twitter/Facebook like real time wall updates using Pusher API and jQuery. This tutorial &amp;lt;a href=&#39;http://www.webspeaks.in/2012/04/twitter-like-real-time-wall-update.html&#39; style=&#39;color:#cc0000&#39;&amp;gt;click here&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt; &lt;br /&gt;  &amp;lt;/div&amp;gt; &lt;br /&gt;  &amp;lt;div id=&quot;panel-frame&quot;&amp;gt; &lt;br /&gt;   &amp;lt;div class=&quot;panel&quot;&amp;gt; &lt;br /&gt;    &amp;lt;div class=&quot;head&quot;&amp;gt; &lt;br /&gt;     &amp;lt;a href=&quot;#&quot; class=&quot;close&quot;&amp;gt;Close&amp;lt;/a&amp;gt; &lt;br /&gt;    &amp;lt;/div&amp;gt; &lt;br /&gt;    &amp;lt;div class=&quot;data&quot; style=&quot;padding:20px&quot;&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;   &amp;lt;/div&amp;gt; &lt;br /&gt;  &amp;lt;/div&amp;gt; &lt;br /&gt;&lt;br /&gt;  &amp;lt;div class=&quot;left&quot;&amp;gt; &lt;br /&gt;   &amp;lt;div class=&quot;block&quot; id=&quot;1&quot;&amp;gt;Test message&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt; &lt;br /&gt;&amp;lt;/body&amp;gt; &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       2. Initializing Pusher Object&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;var pusher = new Pusher(&#39;352cb21a5ef3e5d8e0fe&#39;); //This is your app key&lt;br /&gt;&lt;br /&gt;//channel is the medium for the communication&lt;br /&gt;var ws_channel = pusher.subscribe(&#39;ws_channel&#39;); //you can create any channel&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       3. Sending data to server&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;$(&#39;#update_btn&#39;).click(function(){&lt;br /&gt; var status = jQuery.trim(jQuery(&#39;#status&#39;).val()); //get the status&lt;br /&gt; var username = jQuery.trim(jQuery(&#39;#username&#39;).val()); get the username&lt;br /&gt; if(status == &#39;&#39;){&lt;br /&gt;  alert(&#39;Please enter your message.&#39;);&lt;br /&gt;  jQuery(&#39;#status&#39;).focus();&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt; if(username == &#39;&#39;){&lt;br /&gt;  alert(&#39;Please enter your username.&#39;);&lt;br /&gt;  jQuery(&#39;#username&#39;).focus();&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; //make ajax call to the server&lt;br /&gt; $.ajax({&lt;br /&gt;  type : &quot;POST&quot;,&lt;br /&gt;  url : &#39;send_update.php&#39;,&lt;br /&gt;  dataType : &quot;json&quot;,&lt;br /&gt;  data: { update : status, username : username },&lt;br /&gt;  beforeSend: function(){&lt;br /&gt;   jQuery(&#39;#update_btn&#39;).val(&#39;Updating...&#39;);&lt;br /&gt;  },&lt;br /&gt;  success : function(msg) {&lt;br /&gt;   if( msg.success ) {&lt;br /&gt;    //do nothing&lt;br /&gt;   } else {&lt;br /&gt;    //alert(msg.errormsg);&lt;br /&gt;   }&lt;br /&gt;   jQuery(&#39;#update_btn&#39;).val(&#39;Update&#39;);&lt;br /&gt;  },&lt;br /&gt;  error: function(msg) {&lt;br /&gt;  }&lt;br /&gt; });&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       4. Create send_update.php&lt;/h2&gt;Note that we have created &#39;new_update&#39; event in this file. This event is fired when the status update takes place and it can be used in the JavaScript code on client side like any other event. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;//include the pusher publisher library&lt;br /&gt;include_once &#39;Pusher.php&#39;;&lt;br /&gt;&lt;br /&gt;$pusher = new Pusher(&lt;br /&gt; &#39;352cb21a5ef3e5d8e0fe&#39;, //APP KEY&lt;br /&gt; &#39;88cbaa5abd8c8d8d7fa9&#39;, //APP SECRET&lt;br /&gt; &#39;18728&#39; //APP ID&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//get the message posted by our ajax call&lt;br /&gt;$update = $_POST[&#39;update&#39;];&lt;br /&gt;$username = $_POST[&#39;username&#39;];&lt;br /&gt;&lt;br /&gt;//trim it&lt;br /&gt;$update = trim($update);&lt;br /&gt;$username = trim($username);&lt;br /&gt;&lt;br /&gt;$message = &quot;{$update} &amp;lt;span class=&#39;username&#39;&amp;gt;@{$username}&amp;lt;/span&amp;gt; &amp;lt;span class=&#39;time&#39;&amp;gt; &quot;.date(&#39;Y-m-d H:i:s&#39;).&#39;&amp;lt;/time&amp;gt;&#39;;&lt;br /&gt;&lt;br /&gt;//trigger the &#39;new_update&#39; event in our channel, &#39;ws_channel&#39;&lt;br /&gt;$pusher-&amp;gt;trigger(&lt;br /&gt; &#39;ws_channel&#39;, //the channel&lt;br /&gt; &#39;new_update&#39;, //the event&lt;br /&gt; array(&#39;update&#39; =&amp;gt; $message) //the data to send&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//to be returned to our ajax call&lt;br /&gt;echo json_encode(array(&lt;br /&gt; &#39;update&#39; =&amp;gt; $message,&lt;br /&gt; &#39;success&#39; =&amp;gt; true&lt;br /&gt;));&lt;br /&gt;exit();&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       5. Bind the event in client side JavaScript&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;//new_update was triggered in send_update.php&lt;br /&gt;//bind our update code with new_update event&lt;br /&gt;ws_channel.bind(&#39;new_update&#39;, function(data) {&lt;br /&gt; update_wall(data);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;//this function performs the update&lt;br /&gt;function update_wall(data) {&lt;br /&gt; var parent = $(&#39;div.left&#39;);&lt;br /&gt; var len = parent.find(&#39;div.block&#39;).length;&lt;br /&gt; var htm = &#39;&amp;lt;div class=&quot;block&quot; id=&quot;&#39;+len+&#39;&quot;&amp;gt;&#39;+ data.update +&#39;&amp;lt;/div&amp;gt;&#39;;&lt;br /&gt; parent.prepend(htm);&lt;br /&gt; jQuery(&#39;#status&#39;).val(&#39;&#39;);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       6. Show the twitter style detail window&lt;/h2&gt;This code has been borrowed from Srinivas Tamada at &lt;a href=&quot;http://www.blogger.com/www.9lessons.info/2010/10/new-twitter-design-css-jquery.html&quot; target=&quot;_blank&quot;&gt;9lessons&lt;/a&gt;. &lt;br /&gt;&lt;pre class=&quot;brush:js&quot;&gt;$(&#39;.block&#39;).live(&#39;click&#39;, function(){&lt;br /&gt; var id= $(this).attr(&#39;id&#39;);&lt;br /&gt; var text = $(this).html();&lt;br /&gt; var data_id= $(&quot;.data&quot;).html();&lt;br /&gt; var panel= $(&#39;.panel&#39;);&lt;br /&gt; var panel_width=$(&#39;.panel&#39;).css(&#39;left&#39;);&lt;br /&gt; if(data_id==id){&lt;br /&gt;  panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt; }else{&lt;br /&gt;  if(panel_width==&#39;341px&#39;){&lt;br /&gt;&lt;br /&gt;  }else{&lt;br /&gt;   panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; $(&#39;.data&#39;).html(text);&lt;br /&gt; return false;&lt;br /&gt;});&lt;br /&gt;$(&#39;.close&#39;).click(function(){&lt;br /&gt; var panel= $(&#39;.panel&#39;);&lt;br /&gt; panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt; return false;&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;       7. Complete JavaScript Code&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;var pusher = new Pusher(&#39;352cb21a5ef3e5d8e0fe&#39;);&lt;br /&gt;var ws_channel = pusher.subscribe(&#39;ws_channel&#39;); //join the ws_channel channel&lt;br /&gt;&lt;br /&gt;$(document).ready(function() {&lt;br /&gt; $(&#39;.block&#39;).live(&#39;click&#39;, function(){&lt;br /&gt;  var id= $(this).attr(&#39;id&#39;);&lt;br /&gt;  var text = $(this).html();&lt;br /&gt;  var data_id= $(&quot;.data&quot;).html();&lt;br /&gt;  var panel= $(&#39;.panel&#39;);&lt;br /&gt;  var panel_width=$(&#39;.panel&#39;).css(&#39;left&#39;);&lt;br /&gt;  if(data_id==id){&lt;br /&gt;   panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;  }else{&lt;br /&gt;   if(panel_width==&#39;341px&#39;){&lt;br /&gt;&lt;br /&gt;   }else{&lt;br /&gt;    panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  $(&#39;.data&#39;).html(text);&lt;br /&gt;  return false;&lt;br /&gt; });&lt;br /&gt; $(&#39;.close&#39;).click(function(){&lt;br /&gt;  var panel= $(&#39;.panel&#39;);&lt;br /&gt;  panel.animate({left: parseInt(panel.css(&#39;left&#39;),0) == 0 ? +panel.outerWidth() : 0});&lt;br /&gt;  return false;&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt; function update_wall(data) {&lt;br /&gt;  var parent = $(&#39;div.left&#39;);&lt;br /&gt;  var len = parent.find(&#39;div.block&#39;).length;&lt;br /&gt;  var htm = &#39;&amp;lt;div class=&quot;block&quot; id=&quot;&#39;+len+&#39;&quot;&amp;gt;&#39;+ data.update +&#39;&amp;lt;/div&amp;gt;&#39;;&lt;br /&gt;  parent.prepend(htm);&lt;br /&gt;  jQuery(&#39;#status&#39;).val(&#39;&#39;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; ws_channel.bind(&#39;new_update&#39;, function(data) {&lt;br /&gt;  update_wall(data);&lt;br /&gt; });&lt;br /&gt;&lt;br /&gt; $(&#39;#update_btn&#39;).click(function(){&lt;br /&gt;  var status = jQuery.trim(jQuery(&#39;#status&#39;).val());&lt;br /&gt;  var username = jQuery.trim(jQuery(&#39;#username&#39;).val());&lt;br /&gt;  if(status == &#39;&#39;){&lt;br /&gt;   alert(&#39;Please enter your message.&#39;);&lt;br /&gt;   jQuery(&#39;#status&#39;).focus();&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  if(username == &#39;&#39;){&lt;br /&gt;   alert(&#39;Please enter your username.&#39;);&lt;br /&gt;   jQuery(&#39;#username&#39;).focus();&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  $.ajax({&lt;br /&gt;   type : &quot;POST&quot;,&lt;br /&gt;   url : &#39;send_update.php&#39;,&lt;br /&gt;   dataType : &quot;json&quot;,&lt;br /&gt;   data: { update : status, username : username },&lt;br /&gt;   beforeSend: function(){&lt;br /&gt;    jQuery(&#39;#update_btn&#39;).val(&#39;Updating...&#39;);&lt;br /&gt;   },&lt;br /&gt;   success : function(msg) {&lt;br /&gt;    if( msg.success ) {&lt;br /&gt;     //do nothing&lt;br /&gt;    } else {&lt;br /&gt;     //alert(msg.errormsg);&lt;br /&gt;    }&lt;br /&gt;    jQuery(&#39;#update_btn&#39;).val(&#39;Update&#39;);&lt;br /&gt;   },&lt;br /&gt;   error: function(msg) {&lt;br /&gt;   }&lt;br /&gt;  });&lt;br /&gt; });&lt;br /&gt;});&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/2309815622380569900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/04/twitter-like-real-time-wall-update.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/2309815622380569900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/2309815622380569900'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/04/twitter-like-real-time-wall-update.html' title='Twitter like Real Time Wall Update Using Pusher API and jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSXfR_S8blOgi0zjAKvknKPGGTRAFwEjNIdzbMCfgTVkTfu-3_yykk5ZZ1JjG9mBbCHYwJwj1mWycp7bwIMqROtAoGmVt8FvVwN3yXXj478O-SqoEywu07yxcc_ImJM1NT3O_zX25rxDM/s72-c/Twitter+like+real+time+wall+update+using+Pusher+API+-+WebSpeaks+2012-04-18+16-35-14.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-9046232621875802528</id><published>2012-04-16T02:38:00.001-07:00</published><updated>2012-05-20T22:39:41.350-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Dynamic page update in jQuery Mobile using JSON</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;While creating your jQuery mobile application, you may want to show various records/data on the page. The number of records may be large and may span upto 100s. In such situations it is not at all logical to create 100 static pages using HTML5 divs or sections. But the most intelligent approach here is to dynamically update the content of a single page and show all records on that page only. I will show you how to achieve this in jQuery mobile. See the &lt;a href=&quot;http://demos.frnzzz.com/jqm/page_update.php&quot; target=&quot;_blank&quot;&gt;live demo here&lt;/a&gt;.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOLbWCef5EGfBh4ejN7m0ByNe4qT-beY2QueefoWedT_g67bzpQkAWQZTawDzdLnGatP0i04bmoCG4-lRXswppZ-c_Y1vFO-yyxa6mHfZdDkdFnJA2HLExWZXv2-MUshYFkUwDHRhhOV4/s1600/Dynamic+page+update+2012-04-16+14-35-43.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOLbWCef5EGfBh4ejN7m0ByNe4qT-beY2QueefoWedT_g67bzpQkAWQZTawDzdLnGatP0i04bmoCG4-lRXswppZ-c_Y1vFO-yyxa6mHfZdDkdFnJA2HLExWZXv2-MUshYFkUwDHRhhOV4/s320/Dynamic+page+update+2012-04-16+14-35-43.png&quot; width=&quot;251&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;Here is the approach that I followed:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Create a JSON file to store the data.&lt;/li&gt;&lt;li&gt;Update the page content each time a record is requested.&lt;/li&gt;&lt;/ol&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/jqm/page_update.php&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/d/?f=jqm/jqm-page_update.zip&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;       1. First of all let us create the basic layout of our HTML5 page&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt; &lt;br /&gt;&amp;lt;html&amp;gt; &lt;br /&gt;  &amp;lt;head&amp;gt; &lt;br /&gt;  &amp;lt;title&amp;gt;Dynamic page update&amp;lt;/title&amp;gt; &lt;br /&gt;  &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt; &lt;br /&gt;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;lib/jquery.mobile-1.0.1.min.css&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;script src=&quot;lib/jquery-1.6.4.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script src=&quot;lib/jquery.mobile-1.0.1.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script src=&quot;lib/page_update.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;!-- The main page --&amp;gt;&lt;br /&gt;&amp;lt;section data-role=&quot;page&quot; id=&quot;main&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The header --&amp;gt;&lt;br /&gt;  &amp;lt;div data-role=&quot;header&quot;&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;Dynamic Page Update&amp;lt;/h1&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The navigation bar --&amp;gt;&lt;br /&gt;    &amp;lt;nav data-role=&quot;navbar&quot;&amp;gt;&lt;br /&gt;      &amp;lt;ul&amp;gt;&lt;br /&gt;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; id=&quot;prev&quot;&amp;gt;Prev&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; id=&quot;next&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;      &amp;lt;/ul&amp;gt;&lt;br /&gt;    &amp;lt;/nav&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The content area --&amp;gt;&lt;br /&gt;  &amp;lt;div data-role=&quot;content&quot; id=&quot;main-content&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The footer --&amp;gt;&lt;br /&gt;  &amp;lt;div data-role=&quot;footer&quot;&amp;gt;&lt;br /&gt;    &amp;lt;h4&amp;gt;&lt;br /&gt;      &amp;lt;a href=&quot;#main&quot; data-role=&quot;button&quot; data-icon=&quot;home&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;    &amp;lt;/h4&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/section&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyj2X613eNooTuydxhN1qXescYGEJB4x9_UyMtC5QHcBk1OABOWZGnflyt5cCySFYzwonmpguFFU1Q19BSlFS7qL6SNV0nzBenqQnL_okSLFPTLOfKotA503duYvDECtSw9y4qEPew_OI/s1600/jqm-page_update.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyj2X613eNooTuydxhN1qXescYGEJB4x9_UyMtC5QHcBk1OABOWZGnflyt5cCySFYzwonmpguFFU1Q19BSlFS7qL6SNV0nzBenqQnL_okSLFPTLOfKotA503duYvDECtSw9y4qEPew_OI/s400/jqm-page_update.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;The Page Layout&lt;/div&gt;&lt;h2&gt; 2. Next we will create the JSON file to store our data&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;[&lt;br /&gt; {&lt;br /&gt;  &quot;events&quot;:&lt;br /&gt;   [&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;Old Trafford, Manchester&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;14 August 1990&quot;&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;Sydney Cricket Ground, Sydney&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;6 January 1992&quot;&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;WACA Ground, Perth&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;3 February 1992&quot;&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;Sher-e-Bangla National Stadium (3), Mirpur&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;16 March 2012&quot;&lt;br /&gt;    }&lt;br /&gt;   ]&lt;br /&gt; }&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         3. Declaring various global variables&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Initialize global variables&lt;br /&gt;var cur_record         = 1;&lt;br /&gt;var UPPER_RECORD_LIMIT = 4;&lt;br /&gt;var LOWER_RECORD_LIMIT = 1;&lt;br /&gt;var HASH               = &#39;#&#39;;&lt;br /&gt;var TRANSITION_TYPE    = &#39;slide&#39;;&lt;br /&gt;var PAGE_ID            = &#39;main&#39;;&lt;br /&gt;var PAGE_CONTENT_ID    = &#39;main-content&#39;;&lt;br /&gt;var NEXT_BTN_ID        = &#39;next&#39;;&lt;br /&gt;var PREV_BTN_ID        = &#39;prev&#39;;&lt;br /&gt;&lt;br /&gt;var ALL_RECORDS        = &#39;&#39;;&lt;br /&gt;var EVENTS             = &#39;&#39;;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         4. Now in our JavaScript file we will fetch the data from our JSON file using AJAX.&lt;/h2&gt;We will store the data in some global variable. &lt;br /&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Get the records from JSON file&lt;br /&gt;jQuery.getJSON(&quot;lib/page_data.json&quot;, function(data){&lt;br /&gt; setRecords(data);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;//Store the records in global variables&lt;br /&gt;function setRecords(data) {&lt;br /&gt; ALL_RECORDS = data;&lt;br /&gt; EVENTS = ALL_RECORDS[0].events;&lt;br /&gt; UPPER_RECORD_LIMIT = EVENTS.length;&lt;br /&gt; updateRecordsData();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         5. Now we will update the content of the page upon document.ready event of jQuery.&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Update the page content&lt;br /&gt;function updateRecordsData(){&lt;br /&gt; var this_page = jQuery(HASH+PAGE_ID).find(HASH + PAGE_CONTENT_ID);&lt;br /&gt; var venue = EVENTS[cur_record-1].venue;&lt;br /&gt; var date = EVENTS[cur_record-1].date;&lt;br /&gt;&lt;br /&gt; var htm = &#39;&#39;;&lt;br /&gt; htm += &#39;&amp;lt;ul data-role=&quot;listview&quot;&amp;gt;&#39;;&lt;br /&gt;     htm += &#39;  &amp;lt;li&amp;gt;Date: &#39; + date + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;     htm += &#39;  &amp;lt;li&amp;gt;Venue: &#39; + venue + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;     htm += &#39;&amp;lt;/ul&amp;gt;&#39;;&lt;br /&gt; jQuery( HASH + PAGE_ID ).find( HASH + PAGE_CONTENT_ID ).html(htm);&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         6. Show next and previous records&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;  //Go to next record&lt;br /&gt;  function gotoNextRecord() {&lt;br /&gt;    cur_record++;&lt;br /&gt;    if(cur_record &amp;gt; UPPER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = LOWER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Go to previous record&lt;br /&gt;  function gotoPrevRecord() {&lt;br /&gt;    cur_record--;&lt;br /&gt;    if(cur_record &amp;lt; LOWER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = UPPER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         7. Binding the click and swipe events&lt;/h2&gt;jQuery mobile provides pre-built touch events for swipe. You can bind these events like this: &lt;br /&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Bind events with next/previous buttons&lt;br /&gt;jQuery(HASH + NEXT_BTN_ID).bind(&#39;click&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;jQuery(HASH + PREV_BTN_ID).bind(&#39;click&#39;, gotoPrevRecord);&lt;br /&gt;&lt;br /&gt;jQuery(HASH+PAGE_ID).bind(&#39;swipeleft&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;jQuery(HASH+PAGE_ID).bind(&#39;swiperight&#39;, gotoPrevRecord);&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         8. The final code&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;jQuery(document).ready(function() {&lt;br /&gt;&lt;br /&gt;  //Initialize global variables&lt;br /&gt;  var cur_record         = 1;&lt;br /&gt;  var UPPER_RECORD_LIMIT = 4;&lt;br /&gt;  var LOWER_RECORD_LIMIT = 1;&lt;br /&gt;  var HASH               = &#39;#&#39;;&lt;br /&gt;  var TRANSITION_TYPE    = &#39;slide&#39;;&lt;br /&gt;  var PAGE_ID            = &#39;main&#39;;&lt;br /&gt;  var PAGE_CONTENT_ID    = &#39;main-content&#39;;&lt;br /&gt;  var NEXT_BTN_ID        = &#39;next&#39;;&lt;br /&gt;  var PREV_BTN_ID        = &#39;prev&#39;;&lt;br /&gt;&lt;br /&gt;  var ALL_RECORDS        = &#39;&#39;;&lt;br /&gt;  var EVENTS             = &#39;&#39;;&lt;br /&gt;&lt;br /&gt;  //Get the records from JSON file&lt;br /&gt;  jQuery.getJSON(&quot;lib/page_data.json&quot;, function(data){&lt;br /&gt;    setRecords(data);&lt;br /&gt;  });&lt;br /&gt;&lt;br /&gt;  //Store the records in global variables&lt;br /&gt;  function setRecords(data) {&lt;br /&gt;    ALL_RECORDS = data;&lt;br /&gt;    EVENTS = ALL_RECORDS[0].events;&lt;br /&gt;    UPPER_RECORD_LIMIT = EVENTS.length;&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Update the page content&lt;br /&gt;  function updateRecordsData(){&lt;br /&gt;    var this_page = jQuery(HASH+PAGE_ID).find(HASH + PAGE_CONTENT_ID);&lt;br /&gt;    var venue = EVENTS[cur_record-1].venue;&lt;br /&gt;    var date = EVENTS[cur_record-1].date;&lt;br /&gt;&lt;br /&gt;    var htm = &#39;&#39;;&lt;br /&gt;    htm += &#39;&amp;lt;ul data-role=&quot;listview&quot;&amp;gt;&#39;;&lt;br /&gt;        htm += &#39;  &amp;lt;li&amp;gt;Date: &#39; + date + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;        htm += &#39;  &amp;lt;li&amp;gt;Venue: &#39; + venue + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;        htm += &#39;&amp;lt;/ul&amp;gt;&#39;;&lt;br /&gt;    jQuery( HASH + PAGE_ID ).find( HASH + PAGE_CONTENT_ID ).html(htm);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Go to next record&lt;br /&gt;  function gotoNextRecord() {&lt;br /&gt;    cur_record++;&lt;br /&gt;    if(cur_record &amp;gt; UPPER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = LOWER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Go to previous record&lt;br /&gt;  function gotoPrevRecord() {&lt;br /&gt;    cur_record--;&lt;br /&gt;    if(cur_record &amp;lt; LOWER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = UPPER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Bind events with next/previous buttons&lt;br /&gt;  jQuery(HASH + NEXT_BTN_ID).bind(&#39;click&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;  jQuery(HASH + PREV_BTN_ID).bind(&#39;click&#39;, gotoPrevRecord);&lt;br /&gt;&lt;br /&gt;  jQuery(HASH+PAGE_ID).bind(&#39;swipeleft&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;  jQuery(HASH+PAGE_ID).bind(&#39;swiperight&#39;, gotoPrevRecord);&lt;br /&gt;&lt;br /&gt;});&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/9046232621875802528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/04/dynamic-page-update-in-jquery-mobile_16.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/9046232621875802528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/9046232621875802528'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/04/dynamic-page-update-in-jquery-mobile_16.html' title='Dynamic page update in jQuery Mobile using JSON'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOLbWCef5EGfBh4ejN7m0ByNe4qT-beY2QueefoWedT_g67bzpQkAWQZTawDzdLnGatP0i04bmoCG4-lRXswppZ-c_Y1vFO-yyxa6mHfZdDkdFnJA2HLExWZXv2-MUshYFkUwDHRhhOV4/s72-c/Dynamic+page+update+2012-04-16+14-35-43.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-8511797263046340492</id><published>2012-04-16T02:38:00.000-07:00</published><updated>2012-05-20T22:39:41.337-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Dynamic page update in jQuery Mobile using JSON</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;While creating your jQuery mobile application, you may want to show various records/data on the page. The number of records may be large and may span upto 100s. In such situations it is not at all logical to create 100 static pages using HTML5 divs or sections. But the most intelligent approach here is to dynamically update the content of a single page and show all records on that page only. I will show you how to achieve this in jQuery mobile. See the &lt;a href=&quot;http://demos.frnzzz.com/jqm/page_update.php&quot; target=&quot;_blank&quot;&gt;live demo here&lt;/a&gt;.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOLbWCef5EGfBh4ejN7m0ByNe4qT-beY2QueefoWedT_g67bzpQkAWQZTawDzdLnGatP0i04bmoCG4-lRXswppZ-c_Y1vFO-yyxa6mHfZdDkdFnJA2HLExWZXv2-MUshYFkUwDHRhhOV4/s1600/Dynamic+page+update+2012-04-16+14-35-43.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOLbWCef5EGfBh4ejN7m0ByNe4qT-beY2QueefoWedT_g67bzpQkAWQZTawDzdLnGatP0i04bmoCG4-lRXswppZ-c_Y1vFO-yyxa6mHfZdDkdFnJA2HLExWZXv2-MUshYFkUwDHRhhOV4/s320/Dynamic+page+update+2012-04-16+14-35-43.png&quot; width=&quot;251&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;Here is the approach that I followed:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Create a JSON file to store the data.&lt;/li&gt;&lt;li&gt;Update the page content each time a record is requested.&lt;/li&gt;&lt;/ol&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/jqm/page_update.php&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/d/?f=jqm/jqm-page_update.zip&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;       1. First of all let us create the basic layout of our HTML5 page&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt; &lt;br /&gt;&amp;lt;html&amp;gt; &lt;br /&gt;  &amp;lt;head&amp;gt; &lt;br /&gt;  &amp;lt;title&amp;gt;Dynamic page update&amp;lt;/title&amp;gt; &lt;br /&gt;  &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt; &lt;br /&gt;  &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;lib/jquery.mobile-1.0.1.min.css&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;script src=&quot;lib/jquery-1.6.4.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script src=&quot;lib/jquery.mobile-1.0.1.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script src=&quot;lib/page_update.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;!-- The main page --&amp;gt;&lt;br /&gt;&amp;lt;section data-role=&quot;page&quot; id=&quot;main&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The header --&amp;gt;&lt;br /&gt;  &amp;lt;div data-role=&quot;header&quot;&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;Dynamic Page Update&amp;lt;/h1&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The navigation bar --&amp;gt;&lt;br /&gt;    &amp;lt;nav data-role=&quot;navbar&quot;&amp;gt;&lt;br /&gt;      &amp;lt;ul&amp;gt;&lt;br /&gt;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; id=&quot;prev&quot;&amp;gt;Prev&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;        &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; id=&quot;next&quot;&amp;gt;Next&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;      &amp;lt;/ul&amp;gt;&lt;br /&gt;    &amp;lt;/nav&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The content area --&amp;gt;&lt;br /&gt;  &amp;lt;div data-role=&quot;content&quot; id=&quot;main-content&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- The footer --&amp;gt;&lt;br /&gt;  &amp;lt;div data-role=&quot;footer&quot;&amp;gt;&lt;br /&gt;    &amp;lt;h4&amp;gt;&lt;br /&gt;      &amp;lt;a href=&quot;#main&quot; data-role=&quot;button&quot; data-icon=&quot;home&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;    &amp;lt;/h4&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/section&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyj2X613eNooTuydxhN1qXescYGEJB4x9_UyMtC5QHcBk1OABOWZGnflyt5cCySFYzwonmpguFFU1Q19BSlFS7qL6SNV0nzBenqQnL_okSLFPTLOfKotA503duYvDECtSw9y4qEPew_OI/s1600/jqm-page_update.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyj2X613eNooTuydxhN1qXescYGEJB4x9_UyMtC5QHcBk1OABOWZGnflyt5cCySFYzwonmpguFFU1Q19BSlFS7qL6SNV0nzBenqQnL_okSLFPTLOfKotA503duYvDECtSw9y4qEPew_OI/s400/jqm-page_update.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;The Page Layout&lt;/div&gt;&lt;h2&gt; 2. Next we will create the JSON file to store our data&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;[&lt;br /&gt; {&lt;br /&gt;  &quot;events&quot;:&lt;br /&gt;   [&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;Old Trafford, Manchester&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;14 August 1990&quot;&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;Sydney Cricket Ground, Sydney&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;6 January 1992&quot;&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;WACA Ground, Perth&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;3 February 1992&quot;&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;     &quot;venue&quot;:&quot;Sher-e-Bangla National Stadium (3), Mirpur&quot;,&lt;br /&gt;     &quot;date&quot;:&quot;16 March 2012&quot;&lt;br /&gt;    }&lt;br /&gt;   ]&lt;br /&gt; }&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         3. Declaring various global variables&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Initialize global variables&lt;br /&gt;var cur_record         = 1;&lt;br /&gt;var UPPER_RECORD_LIMIT = 4;&lt;br /&gt;var LOWER_RECORD_LIMIT = 1;&lt;br /&gt;var HASH               = &#39;#&#39;;&lt;br /&gt;var TRANSITION_TYPE    = &#39;slide&#39;;&lt;br /&gt;var PAGE_ID            = &#39;main&#39;;&lt;br /&gt;var PAGE_CONTENT_ID    = &#39;main-content&#39;;&lt;br /&gt;var NEXT_BTN_ID        = &#39;next&#39;;&lt;br /&gt;var PREV_BTN_ID        = &#39;prev&#39;;&lt;br /&gt;&lt;br /&gt;var ALL_RECORDS        = &#39;&#39;;&lt;br /&gt;var EVENTS             = &#39;&#39;;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         4. Now in our JavaScript file we will fetch the data from our JSON file using AJAX.&lt;/h2&gt;We will store the data in some global variable. &lt;br /&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Get the records from JSON file&lt;br /&gt;jQuery.getJSON(&quot;lib/page_data.json&quot;, function(data){&lt;br /&gt; setRecords(data);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;//Store the records in global variables&lt;br /&gt;function setRecords(data) {&lt;br /&gt; ALL_RECORDS = data;&lt;br /&gt; EVENTS = ALL_RECORDS[0].events;&lt;br /&gt; UPPER_RECORD_LIMIT = EVENTS.length;&lt;br /&gt; updateRecordsData();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         5. Now we will update the content of the page upon document.ready event of jQuery.&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Update the page content&lt;br /&gt;function updateRecordsData(){&lt;br /&gt; var this_page = jQuery(HASH+PAGE_ID).find(HASH + PAGE_CONTENT_ID);&lt;br /&gt; var venue = EVENTS[cur_record-1].venue;&lt;br /&gt; var date = EVENTS[cur_record-1].date;&lt;br /&gt;&lt;br /&gt; var htm = &#39;&#39;;&lt;br /&gt; htm += &#39;&amp;lt;ul data-role=&quot;listview&quot;&amp;gt;&#39;;&lt;br /&gt;     htm += &#39;  &amp;lt;li&amp;gt;Date: &#39; + date + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;     htm += &#39;  &amp;lt;li&amp;gt;Venue: &#39; + venue + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;     htm += &#39;&amp;lt;/ul&amp;gt;&#39;;&lt;br /&gt; jQuery( HASH + PAGE_ID ).find( HASH + PAGE_CONTENT_ID ).html(htm);&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         6. Show next and previous records&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;  //Go to next record&lt;br /&gt;  function gotoNextRecord() {&lt;br /&gt;    cur_record++;&lt;br /&gt;    if(cur_record &amp;gt; UPPER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = LOWER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Go to previous record&lt;br /&gt;  function gotoPrevRecord() {&lt;br /&gt;    cur_record--;&lt;br /&gt;    if(cur_record &amp;lt; LOWER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = UPPER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         7. Binding the click and swipe events&lt;/h2&gt;jQuery mobile provides pre-built touch events for swipe. You can bind these events like this: &lt;br /&gt;&lt;pre class=&quot;brush:js&quot;&gt;//Bind events with next/previous buttons&lt;br /&gt;jQuery(HASH + NEXT_BTN_ID).bind(&#39;click&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;jQuery(HASH + PREV_BTN_ID).bind(&#39;click&#39;, gotoPrevRecord);&lt;br /&gt;&lt;br /&gt;jQuery(HASH+PAGE_ID).bind(&#39;swipeleft&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;jQuery(HASH+PAGE_ID).bind(&#39;swiperight&#39;, gotoPrevRecord);&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;         8. The final code&lt;/h2&gt;&lt;pre class=&quot;brush:js&quot;&gt;jQuery(document).ready(function() {&lt;br /&gt;&lt;br /&gt;  //Initialize global variables&lt;br /&gt;  var cur_record         = 1;&lt;br /&gt;  var UPPER_RECORD_LIMIT = 4;&lt;br /&gt;  var LOWER_RECORD_LIMIT = 1;&lt;br /&gt;  var HASH               = &#39;#&#39;;&lt;br /&gt;  var TRANSITION_TYPE    = &#39;slide&#39;;&lt;br /&gt;  var PAGE_ID            = &#39;main&#39;;&lt;br /&gt;  var PAGE_CONTENT_ID    = &#39;main-content&#39;;&lt;br /&gt;  var NEXT_BTN_ID        = &#39;next&#39;;&lt;br /&gt;  var PREV_BTN_ID        = &#39;prev&#39;;&lt;br /&gt;&lt;br /&gt;  var ALL_RECORDS        = &#39;&#39;;&lt;br /&gt;  var EVENTS             = &#39;&#39;;&lt;br /&gt;&lt;br /&gt;  //Get the records from JSON file&lt;br /&gt;  jQuery.getJSON(&quot;lib/page_data.json&quot;, function(data){&lt;br /&gt;    setRecords(data);&lt;br /&gt;  });&lt;br /&gt;&lt;br /&gt;  //Store the records in global variables&lt;br /&gt;  function setRecords(data) {&lt;br /&gt;    ALL_RECORDS = data;&lt;br /&gt;    EVENTS = ALL_RECORDS[0].events;&lt;br /&gt;    UPPER_RECORD_LIMIT = EVENTS.length;&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Update the page content&lt;br /&gt;  function updateRecordsData(){&lt;br /&gt;    var this_page = jQuery(HASH+PAGE_ID).find(HASH + PAGE_CONTENT_ID);&lt;br /&gt;    var venue = EVENTS[cur_record-1].venue;&lt;br /&gt;    var date = EVENTS[cur_record-1].date;&lt;br /&gt;&lt;br /&gt;    var htm = &#39;&#39;;&lt;br /&gt;    htm += &#39;&amp;lt;ul data-role=&quot;listview&quot;&amp;gt;&#39;;&lt;br /&gt;        htm += &#39;  &amp;lt;li&amp;gt;Date: &#39; + date + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;        htm += &#39;  &amp;lt;li&amp;gt;Venue: &#39; + venue + &#39;&amp;lt;/li&amp;gt;&#39;;&lt;br /&gt;        htm += &#39;&amp;lt;/ul&amp;gt;&#39;;&lt;br /&gt;    jQuery( HASH + PAGE_ID ).find( HASH + PAGE_CONTENT_ID ).html(htm);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Go to next record&lt;br /&gt;  function gotoNextRecord() {&lt;br /&gt;    cur_record++;&lt;br /&gt;    if(cur_record &amp;gt; UPPER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = LOWER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Go to previous record&lt;br /&gt;  function gotoPrevRecord() {&lt;br /&gt;    cur_record--;&lt;br /&gt;    if(cur_record &amp;lt; LOWER_RECORD_LIMIT) {&lt;br /&gt;      cur_record = UPPER_RECORD_LIMIT;&lt;br /&gt;    }&lt;br /&gt;    updateRecordsData();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Bind events with next/previous buttons&lt;br /&gt;  jQuery(HASH + NEXT_BTN_ID).bind(&#39;click&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;  jQuery(HASH + PREV_BTN_ID).bind(&#39;click&#39;, gotoPrevRecord);&lt;br /&gt;&lt;br /&gt;  jQuery(HASH+PAGE_ID).bind(&#39;swipeleft&#39;, gotoNextRecord);&lt;br /&gt;&lt;br /&gt;  jQuery(HASH+PAGE_ID).bind(&#39;swiperight&#39;, gotoPrevRecord);&lt;br /&gt;&lt;br /&gt;});&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/8511797263046340492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/04/dynamic-page-update-in-jquery-mobile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8511797263046340492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8511797263046340492'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/04/dynamic-page-update-in-jquery-mobile.html' title='Dynamic page update in jQuery Mobile using JSON'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOLbWCef5EGfBh4ejN7m0ByNe4qT-beY2QueefoWedT_g67bzpQkAWQZTawDzdLnGatP0i04bmoCG4-lRXswppZ-c_Y1vFO-yyxa6mHfZdDkdFnJA2HLExWZXv2-MUshYFkUwDHRhhOV4/s72-c/Dynamic+page+update+2012-04-16+14-35-43.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-4613223228412520896</id><published>2012-04-09T23:56:00.001-07:00</published><updated>2012-05-20T22:39:41.279-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>jQuery Mobile tutorial for Beginners</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;jQuery Mobile is a set of jQuery plug-ins and widgets that aim to provide a cross-platform API for creating mobile web applications. In terms of code implementation, jQuery Mobile is very similar to jQuery UI, but while jQuery UI is focused on desktop applications, jQuery Mobile is built with mobile devices in mind. jQuery Mobile uses HTML 5 and CSS 3 features to enhance basic HTML markup to create a consistent mobile experience across supported platforms. See &lt;a href=&quot;http://demos.frnzzz.com/jqm/&quot; target=&quot;_blank&quot;&gt;live demo here&lt;/a&gt;.&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s1600/jQuery+Mobile+2012-04-10+12-03-13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s1600/jQuery+Mobile+2012-04-10+12-03-13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s320/jQuery+Mobile+2012-04-10+12-03-13.png&quot; width=&quot;263&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/jqm/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;       Create Your First jQuery Mobile Application&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;jQuery Mobile Application&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0a4.1/&lt;br /&gt;     jquery.mobile-1.0a4.1.min.css&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/jquery-1.5.2.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- The page starts --&amp;gt;&lt;br /&gt; &amp;lt;section id=&quot;page1&quot; data-role=&quot;page&quot;&amp;gt;&lt;br /&gt;   &amp;lt;!-- The header --&amp;gt;&lt;br /&gt;   &amp;lt;header data-role=&quot;header&quot;&amp;gt;&amp;lt;h1&amp;gt;jQuery Mobile&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt;&lt;br /&gt;   &amp;lt;!-- The header --&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- The body --&amp;gt;&lt;br /&gt;   &amp;lt;div class=&quot;content&quot; data-role=&quot;content&quot;&amp;gt;&lt;br /&gt;     &amp;lt;p&amp;gt;Welcome to jQuery Mobile!&amp;lt;/p&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;!-- The body --&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- The footer --&amp;gt;&lt;br /&gt;   &amp;lt;footer data-role=&quot;footer&quot;&amp;gt;&amp;lt;h1&amp;gt;WebSpeaks.in&amp;lt;/h1&amp;gt;&amp;lt;/footer&amp;gt;&lt;br /&gt;   &amp;lt;!-- The footer --&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;jQuery Mobile doesn’t need specific markup, but it does need us to indicate the roles of the content areas somehow. To do this, jQuery Mobile uses a custom data- attribute: data-role. Valid data-role values include page, header, content, and footer.  Adding a new page to the application is as simple as that. Just add a new HTML 5 section with data-role=&quot;page&quot; and it is done. See the following example. &lt;br /&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;jQuery Mobile Application&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0a4.1/&lt;br /&gt;     jquery.mobile-1.0a4.1.min.css&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/jquery-1.5.2.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;section id=&quot;page1&quot; data-role=&quot;page&quot;&amp;gt;&lt;br /&gt;   &amp;lt;header data-role=&quot;header&quot;&amp;gt;&amp;lt;h1&amp;gt;jQuery Mobile&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt;&lt;br /&gt;   &amp;lt;div class=&quot;content&quot; data-role=&quot;content&quot;&amp;gt;&lt;br /&gt;     &amp;lt;p&amp;gt;Welcome to jQuery Mobile!&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;a href=&quot;#page2&quot;&amp;gt;Go to the second page!&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;footer data-role=&quot;footer&quot;&amp;gt;&amp;lt;h1&amp;gt;WebSpeaks.in&amp;lt;/h1&amp;gt;&amp;lt;/footer&amp;gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;section id=&quot;page2&quot; data-role=&quot;page&quot;&amp;gt;&lt;br /&gt;  &amp;lt;header data-role=&quot;header&quot;&amp;gt;&amp;lt;h1&amp;gt;jQuery Mobile&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt;&lt;br /&gt;  &amp;lt;div class=&quot;content&quot; data-role=&quot;content&quot;&amp;gt;&lt;br /&gt;    &amp;lt;p&amp;gt;Second page!&amp;lt;/p&amp;gt;&lt;br /&gt;    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;#page1&quot;&amp;gt;Go to the first page!&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;footer data-role=&quot;footer&quot;&amp;gt;&amp;lt;h1&amp;gt;WebSpeaks.in&amp;lt;/h1&amp;gt;&amp;lt;/footer&amp;gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPR9YAcNfPAGjeKGm4RSa0PBrRZf29FST35RphsI3gS8dTZiDGPkCMnWeuCIW0TToQbeXTfQ45KfRXw35tQF_Xmuf8XLmPbdBAPzlfncodl0jJwpkmoab3Eg3KE_9tj05RlEs3c_EXErA/s1600/jQuery+Mobile+2012-04-10+12-14-01.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPR9YAcNfPAGjeKGm4RSa0PBrRZf29FST35RphsI3gS8dTZiDGPkCMnWeuCIW0TToQbeXTfQ45KfRXw35tQF_Xmuf8XLmPbdBAPzlfncodl0jJwpkmoab3Eg3KE_9tj05RlEs3c_EXErA/s320/jQuery+Mobile+2012-04-10+12-14-01.png&quot; width=&quot;263&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;jQuery mobile will maintain the history of the navigation for you. jQuery Mobile will automatically handle the page transition animation, and will automatically provide a back button in the header. There you have it, your first jQuery Mobile application. It doesn’t do much, but it should give you some insight into the simplicity of the framework. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/4613223228412520896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/04/jquery-mobile-tutorial-for-beginners_09.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/4613223228412520896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/4613223228412520896'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/04/jquery-mobile-tutorial-for-beginners_09.html' title='jQuery Mobile tutorial for Beginners'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s72-c/jQuery+Mobile+2012-04-10+12-03-13.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-637063445831495270</id><published>2012-04-09T23:56:00.000-07:00</published><updated>2012-05-20T22:39:41.302-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>jQuery Mobile tutorial for Beginners</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;jQuery Mobile is a set of jQuery plug-ins and widgets that aim to provide a cross-platform API for creating mobile web applications. In terms of code implementation, jQuery Mobile is very similar to jQuery UI, but while jQuery UI is focused on desktop applications, jQuery Mobile is built with mobile devices in mind. jQuery Mobile uses HTML 5 and CSS 3 features to enhance basic HTML markup to create a consistent mobile experience across supported platforms. See &lt;a href=&quot;http://demos.frnzzz.com/jqm/&quot; target=&quot;_blank&quot;&gt;live demo here&lt;/a&gt;.&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s1600/jQuery+Mobile+2012-04-10+12-03-13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s1600/jQuery+Mobile+2012-04-10+12-03-13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s320/jQuery+Mobile+2012-04-10+12-03-13.png&quot; width=&quot;263&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/jqm/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;       Create Your First jQuery Mobile Application&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;jQuery Mobile Application&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0a4.1/&lt;br /&gt;     jquery.mobile-1.0a4.1.min.css&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/jquery-1.5.2.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;!-- The page starts --&amp;gt;&lt;br /&gt; &amp;lt;section id=&quot;page1&quot; data-role=&quot;page&quot;&amp;gt;&lt;br /&gt;   &amp;lt;!-- The header --&amp;gt;&lt;br /&gt;   &amp;lt;header data-role=&quot;header&quot;&amp;gt;&amp;lt;h1&amp;gt;jQuery Mobile&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt;&lt;br /&gt;   &amp;lt;!-- The header --&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- The body --&amp;gt;&lt;br /&gt;   &amp;lt;div class=&quot;content&quot; data-role=&quot;content&quot;&amp;gt;&lt;br /&gt;     &amp;lt;p&amp;gt;Welcome to jQuery Mobile!&amp;lt;/p&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;!-- The body --&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- The footer --&amp;gt;&lt;br /&gt;   &amp;lt;footer data-role=&quot;footer&quot;&amp;gt;&amp;lt;h1&amp;gt;WebSpeaks.in&amp;lt;/h1&amp;gt;&amp;lt;/footer&amp;gt;&lt;br /&gt;   &amp;lt;!-- The footer --&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;jQuery Mobile doesn’t need specific markup, but it does need us to indicate the roles of the content areas somehow. To do this, jQuery Mobile uses a custom data- attribute: data-role. Valid data-role values include page, header, content, and footer.  Adding a new page to the application is as simple as that. Just add a new HTML 5 section with data-role=&quot;page&quot; and it is done. See the following example. &lt;br /&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;jQuery Mobile Application&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0a4.1/&lt;br /&gt;     jquery.mobile-1.0a4.1.min.css&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/jquery-1.5.2.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;script src=&quot;http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;section id=&quot;page1&quot; data-role=&quot;page&quot;&amp;gt;&lt;br /&gt;   &amp;lt;header data-role=&quot;header&quot;&amp;gt;&amp;lt;h1&amp;gt;jQuery Mobile&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt;&lt;br /&gt;   &amp;lt;div class=&quot;content&quot; data-role=&quot;content&quot;&amp;gt;&lt;br /&gt;     &amp;lt;p&amp;gt;Welcome to jQuery Mobile!&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;a href=&quot;#page2&quot;&amp;gt;Go to the second page!&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;footer data-role=&quot;footer&quot;&amp;gt;&amp;lt;h1&amp;gt;WebSpeaks.in&amp;lt;/h1&amp;gt;&amp;lt;/footer&amp;gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;section id=&quot;page2&quot; data-role=&quot;page&quot;&amp;gt;&lt;br /&gt;  &amp;lt;header data-role=&quot;header&quot;&amp;gt;&amp;lt;h1&amp;gt;jQuery Mobile&amp;lt;/h1&amp;gt;&amp;lt;/header&amp;gt;&lt;br /&gt;  &amp;lt;div class=&quot;content&quot; data-role=&quot;content&quot;&amp;gt;&lt;br /&gt;    &amp;lt;p&amp;gt;Second page!&amp;lt;/p&amp;gt;&lt;br /&gt;    &amp;lt;p&amp;gt;&amp;lt;a href=&quot;#page1&quot;&amp;gt;Go to the first page!&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;footer data-role=&quot;footer&quot;&amp;gt;&amp;lt;h1&amp;gt;WebSpeaks.in&amp;lt;/h1&amp;gt;&amp;lt;/footer&amp;gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPR9YAcNfPAGjeKGm4RSa0PBrRZf29FST35RphsI3gS8dTZiDGPkCMnWeuCIW0TToQbeXTfQ45KfRXw35tQF_Xmuf8XLmPbdBAPzlfncodl0jJwpkmoab3Eg3KE_9tj05RlEs3c_EXErA/s1600/jQuery+Mobile+2012-04-10+12-14-01.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPR9YAcNfPAGjeKGm4RSa0PBrRZf29FST35RphsI3gS8dTZiDGPkCMnWeuCIW0TToQbeXTfQ45KfRXw35tQF_Xmuf8XLmPbdBAPzlfncodl0jJwpkmoab3Eg3KE_9tj05RlEs3c_EXErA/s320/jQuery+Mobile+2012-04-10+12-14-01.png&quot; width=&quot;263&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;jQuery mobile will maintain the history of the navigation for you. jQuery Mobile will automatically handle the page transition animation, and will automatically provide a back button in the header. There you have it, your first jQuery Mobile application. It doesn’t do much, but it should give you some insight into the simplicity of the framework. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/637063445831495270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/04/jquery-mobile-tutorial-for-beginners.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/637063445831495270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/637063445831495270'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/04/jquery-mobile-tutorial-for-beginners.html' title='jQuery Mobile tutorial for Beginners'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcn6fOIumy8R6OgEy2kByL3zZFRU4uYCdO-CRHaIPv9mQaRLI33t8JFno3rpq_kMqd1EgO7sLBrjuJ_JJlPPZAh8vJPAQXQzlv7BbecIOfWM4nYwGutzX-RBoC6zMibkdbclRiJ7cijH0/s72-c/jQuery+Mobile+2012-04-10+12-03-13.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-324996215072817054</id><published>2012-03-13T21:15:00.001-07:00</published><updated>2012-05-20T22:39:41.273-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="google maps"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Why Google Map listing is important</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;SEO is getting more advanced and diverse topics and techniques are surfacing everyday to woo the search engines. In fact the term Google and &#39;search engine&#39; have become synonymous and most websites aim for the top listings on Google. But it is not only Google but literally all search engines that have become a bone of contention for websites and SEO firms. Everybody wants to get noticed in the eyes of these search engines. And it is getting tougher for everyone to keep the visibility of their websites or web pages high, what with millions of web pages and new one getting added every day. One needs to have an insight on how exactly the search algorithms work and which kind of visitors would type what in the search engine. There are no set guidelines like &lt;a href=&quot;http://www.onlinecasino.tm/&quot; target=&quot;_blank&quot;&gt;the best casino guide for gambling players&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;As Google is the unquestionable leader of all search engines it is only natural for most SEO companies to get their websites ranking high on Google. It may be a big deal from the perspective of all kinds and sizes of online business but from a normal person&#39;s perspective, an average person is not concerned with all those issues at all. All a common person is looking for is some useful information, satisfying his needs. And the war for first position has opened up among all SEO firms with the new feature of Google map listings. Just like gaming fans are on constant search for &lt;a href=&quot;http://www.onlinecasino.tm/no-deposit-casinos.html&quot; target=&quot;_blank&quot;&gt;no deposit casino bonus codes&lt;/a&gt;, SEO experts are forever looking for new ways to improve the rankings of their websites.&lt;br /&gt;&lt;br /&gt;Google map listing is an easy and convenient method for people to find a certain business as well as its location so that they know where it is and how to contact them. The websites are registering with Google so as to get the Google map listing on their page and get more popular with common masses. The users can see their business on the map and where clicking further will lead to that particular site/blog or nay other given information. SEO companies still need not overlook the importance of keywords and will need to have a thorough knowledge of how the algorithm realign to Google Maps work and will help in the ranking of local business listings. Make good use of Google map, think of innovative ways for optimization and keep exploring the new maze of keywords to stay ahead of the race. The &lt;a href=&quot;http://www.onlinecasino.tm/slots.htm&quot; target=&quot;_blank&quot;&gt;slots&lt;/a&gt; gaming is highly popular among gamblers and right now it is the Google listings that is at the top priority for most SEO experts. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/324996215072817054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/03/why-google-map-listing-is-important_13.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/324996215072817054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/324996215072817054'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/03/why-google-map-listing-is-important_13.html' title='Why Google Map listing is important'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-6468820827924743746</id><published>2012-03-13T21:15:00.000-07:00</published><updated>2012-05-20T22:39:41.309-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="google maps"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Why Google Map listing is important</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;SEO is getting more advanced and diverse topics and techniques are surfacing everyday to woo the search engines. In fact the term Google and &#39;search engine&#39; have become synonymous and most websites aim for the top listings on Google. But it is not only Google but literally all search engines that have become a bone of contention for websites and SEO firms. Everybody wants to get noticed in the eyes of these search engines. And it is getting tougher for everyone to keep the visibility of their websites or web pages high, what with millions of web pages and new one getting added every day. One needs to have an insight on how exactly the search algorithms work and which kind of visitors would type what in the search engine. There are no set guidelines like &lt;a href=&quot;http://www.onlinecasino.tm/&quot; target=&quot;_blank&quot;&gt;the best casino guide for gambling players&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;As Google is the unquestionable leader of all search engines it is only natural for most SEO companies to get their websites ranking high on Google. It may be a big deal from the perspective of all kinds and sizes of online business but from a normal person&#39;s perspective, an average person is not concerned with all those issues at all. All a common person is looking for is some useful information, satisfying his needs. And the war for first position has opened up among all SEO firms with the new feature of Google map listings. Just like gaming fans are on constant search for &lt;a href=&quot;http://www.onlinecasino.tm/no-deposit-casinos.html&quot; target=&quot;_blank&quot;&gt;no deposit casino bonus codes&lt;/a&gt;, SEO experts are forever looking for new ways to improve the rankings of their websites.&lt;br /&gt;&lt;br /&gt;Google map listing is an easy and convenient method for people to find a certain business as well as its location so that they know where it is and how to contact them. The websites are registering with Google so as to get the Google map listing on their page and get more popular with common masses. The users can see their business on the map and where clicking further will lead to that particular site/blog or nay other given information. SEO companies still need not overlook the importance of keywords and will need to have a thorough knowledge of how the algorithm realign to Google Maps work and will help in the ranking of local business listings. Make good use of Google map, think of innovative ways for optimization and keep exploring the new maze of keywords to stay ahead of the race. The &lt;a href=&quot;http://www.onlinecasino.tm/slots.htm&quot; target=&quot;_blank&quot;&gt;slots&lt;/a&gt; gaming is highly popular among gamblers and right now it is the Google listings that is at the top priority for most SEO experts. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/6468820827924743746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/03/why-google-map-listing-is-important.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/6468820827924743746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/6468820827924743746'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/03/why-google-map-listing-is-important.html' title='Why Google Map listing is important'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-7754499656064843007</id><published>2012-03-09T00:33:00.001-08:00</published><updated>2012-05-20T22:39:41.323-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="ESPN"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Getting Started with ESPN Sports API</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Recently ESPN has launched its Sports API for getting all latest sports update and news. You can register for the API at &lt;a href=&quot;http://developer.espn.com/&quot; target=&quot;_blank&quot;&gt;http://developer.espn.com/&lt;/a&gt;. There you need to get an API key to create your application. The API is very simple and easy to use with a number of options. I have created a simple sports news gallery using the API. &lt;a href=&quot;http://demos.frnzzz.com/espn&quot; target=&quot;_blank&quot;&gt;See it working...&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm54rLSA5GSFO3MBjTtEQsRvCkopnJ6YQEvWVgrCCRK4sAUxpN76zpT0HlE0N3dOq_SliAGwh4AS0PRrpdIWQUctdLVadQiLSOR3zdJK03cJ27QqBhLZUOymLOhMEzJpjNxGUYEMR3lGM/s1600/ESPN+Sports+API+-+WebSpeaks.in+2012-03-09+14-02-34.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm54rLSA5GSFO3MBjTtEQsRvCkopnJ6YQEvWVgrCCRK4sAUxpN76zpT0HlE0N3dOq_SliAGwh4AS0PRrpdIWQUctdLVadQiLSOR3zdJK03cJ27QqBhLZUOymLOhMEzJpjNxGUYEMR3lGM/s320/ESPN+Sports+API+-+WebSpeaks.in+2012-03-09+14-02-34.png&quot; width=&quot;306&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/espn/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://www.box.com/s/5hiofoz5z7zh4oqjgfcc&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&amp;nbsp;  &lt;br /&gt;&lt;h2&gt; &amp;nbsp;&lt;/h2&gt;&lt;h2&gt; &amp;nbsp;jQuery Code:&lt;/h2&gt;&lt;pre class=&quot;brush:javascript&quot;&gt;    $(document).ready(function(){&lt;br /&gt;        var news_limit = 5;&lt;br /&gt;        var news_offset = 0;&lt;br /&gt;&lt;br /&gt;        $(&#39;a#load_more&#39;).click(function(){&lt;br /&gt;            load_more_news();&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        function load_more_news(){&lt;br /&gt;            news_offset += news_limit;&lt;br /&gt;            $.ajax({ &lt;br /&gt;                url: &quot;http://api.espn.com/v1/sports/news/headlines&quot;, &lt;br /&gt;                data: { &lt;br /&gt;                    // enter your developer api key here &lt;br /&gt;                    apikey: &quot;&amp;lt;your_api_key&amp;gt;&quot;,&lt;br /&gt;                    // the type of data you&#39;re expecting back from the api &lt;br /&gt;                    _accept: &quot;application/json&quot;,&lt;br /&gt;                    // number of results to be shown&lt;br /&gt;                    limit: news_limit,&lt;br /&gt;                    offset: news_offset&lt;br /&gt;                }, &lt;br /&gt;                dataType: &quot;jsonp&quot;, &lt;br /&gt;                beforeSend: function(){&lt;br /&gt;                    $(&#39;#result&#39;).html(&#39;Loading...&#39;);&lt;br /&gt;                },&lt;br /&gt;                success: function(data) { &lt;br /&gt;                    $(&#39;#result&#39;).html(&#39;&#39;);&lt;br /&gt;                    // create an unordered list of headlines &lt;br /&gt;                    var ul = $(&#39;ul#list&#39;); &lt;br /&gt;                    $.each(data.headlines, function() { &lt;br /&gt;                     var htm = this.headline;&lt;br /&gt;                     htm += &#39;&amp;lt;a class=&quot;readmore&quot; href=&quot;&#39;+this.links.web.href+&#39;&quot; target=&quot;_blank&quot;&amp;gt;Read more&amp;lt;/a&amp;gt;&#39;;&lt;br /&gt;                        var li = $(&#39;&amp;lt;li/&amp;gt;&#39;).html(htm); &lt;br /&gt;                        ul.append(li) &lt;br /&gt;                    }); &lt;br /&gt;                }, &lt;br /&gt;                error: function() { &lt;br /&gt;                     // handle the error &lt;br /&gt;                } &lt;br /&gt;            });&lt;br /&gt;        }&lt;br /&gt;        load_more_news();&lt;br /&gt;    });&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    HTML Markup&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;ESPN Sports API | WebSpeaks.in&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;div class=&quot;main&quot;&amp;gt;&lt;br /&gt;        &amp;lt;h2&amp;gt;Latest in Sports World&amp;lt;/h2&amp;gt;&lt;br /&gt;        &amp;lt;hr /&amp;gt;&lt;br /&gt;        &amp;lt;div class=&quot;news&quot;&amp;gt;&lt;br /&gt;            &amp;lt;div style=&quot;text-align:center&quot; id=&quot;result&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;            &amp;lt;div&amp;gt;&lt;br /&gt;                &amp;lt;ul id=&quot;list&quot;&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;            &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;hr /&amp;gt;&lt;br /&gt;        &amp;lt;div class=&quot;button&quot;&amp;gt;&amp;lt;a class=&quot;button white bigrounded&quot; id=&quot;load_more&quot;&amp;gt;Load More&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    CSS Code:&lt;/h2&gt;&lt;pre class=&quot;brush:css&quot;&gt;@font-face {&lt;br /&gt; font-family: &quot;UglyQua&quot;;&lt;br /&gt; font-style: normal;&lt;br /&gt; src: url(UglyQua/UglyQua.eot); /*if IE */&lt;br /&gt; src: local(&quot;UglyQua&quot;), url(&quot;UglyQua/UglyQua.ttf&quot;) format(&quot;truetype&quot;); /* non-IE */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{&lt;br /&gt; margin:0px;&lt;br /&gt; padding:0px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;body{&lt;br /&gt; color:#888888;&lt;br /&gt; font-size:13px;&lt;br /&gt; background: #eeeeee;&lt;br /&gt; font-family: &quot;UglyQua&quot;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;hr{&lt;br /&gt; margin-top:10px;&lt;br /&gt; margin-bottom:10px;&lt;br /&gt; color:#eeeeee;&lt;br /&gt;}&lt;br /&gt;div.main{&lt;br /&gt; width:400px;&lt;br /&gt; margin: auto;&lt;br /&gt; padding: 10px;&lt;br /&gt;}&lt;br /&gt;h2{&lt;br /&gt; color:#888888;&lt;br /&gt; font-size:33px;&lt;br /&gt; padding:10px;&lt;br /&gt; text-shadow:2px 1px 6px #333;&lt;br /&gt;}&lt;br /&gt;div.news{&lt;br /&gt; width:400px;&lt;br /&gt; height:auto;&lt;br /&gt; height:415px;&lt;br /&gt; overflow: hidden;&lt;br /&gt; overflow-y: auto;&lt;br /&gt;}&lt;br /&gt;ul li{&lt;br /&gt; padding:8px;&lt;br /&gt; font-size:18px;&lt;br /&gt;}&lt;br /&gt;a.readmore {&lt;br /&gt;    color: #999999;&lt;br /&gt;    font-size: 60%;&lt;br /&gt;    padding-left: 10px;&lt;br /&gt;    text-decoration: underline;&lt;br /&gt;}&lt;br /&gt;div.button{&lt;br /&gt; text-align: center;&lt;br /&gt; padding: 10px;&lt;br /&gt;}&lt;br /&gt;a.button {&lt;br /&gt; display: inline-block;&lt;br /&gt; outline: none;&lt;br /&gt; cursor: pointer;&lt;br /&gt; text-align: center;&lt;br /&gt; text-decoration: none;&lt;br /&gt; font: 14px/100% Arial, Helvetica, sans-serif;&lt;br /&gt; padding: .5em 2em .55em;&lt;br /&gt; text-shadow: 0 1px 1px rgba(0,0,0,.3);&lt;br /&gt; -webkit-border-radius: .5em; &lt;br /&gt; -moz-border-radius: .5em;&lt;br /&gt; border-radius: .5em;&lt;br /&gt; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);&lt;br /&gt; -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);&lt;br /&gt; box-shadow: 0 1px 2px rgba(0,0,0,.2);&lt;br /&gt;}&lt;br /&gt;.white {&lt;br /&gt;  background-attachment:initial;&lt;br /&gt;  background-clip:initial;&lt;br /&gt;  background-color:initial;&lt;br /&gt;  background-image:-webkit-gradient(linear, 0 0%, 0 100%, from(#FFFFFF), to(#EDEDED));&lt;br /&gt;  background-origin:initial;&lt;br /&gt;  background-position:initial initial;&lt;br /&gt;  background-repeat:initial initial;&lt;br /&gt;  border-bottom-color:#B7B7B7;&lt;br /&gt;  border-bottom-style:solid;&lt;br /&gt;  border-bottom-width:1px;&lt;br /&gt;  border-left-color:#B7B7B7;&lt;br /&gt;  border-left-style:solid;&lt;br /&gt;  border-left-width:1px;&lt;br /&gt;  border-right-color:#B7B7B7;&lt;br /&gt;  border-right-style:solid;&lt;br /&gt;  border-right-width:1px;&lt;br /&gt;  border-top-color:#B7B7B7;&lt;br /&gt;  border-top-style:solid;&lt;br /&gt;  border-top-width:1px;&lt;br /&gt;  color:#606060;&lt;br /&gt;}&lt;br /&gt;.bigrounded {&lt;br /&gt;  border-bottom-left-radius:2em 2em;&lt;br /&gt;  border-bottom-right-radius:2em 2em;&lt;br /&gt;  border-top-left-radius:2em 2em;&lt;br /&gt;  border-top-right-radius:2em 2em;&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/7754499656064843007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/03/getting-started-with-espn-sports-api_09.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7754499656064843007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/7754499656064843007'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/03/getting-started-with-espn-sports-api_09.html' title='Getting Started with ESPN Sports API'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm54rLSA5GSFO3MBjTtEQsRvCkopnJ6YQEvWVgrCCRK4sAUxpN76zpT0HlE0N3dOq_SliAGwh4AS0PRrpdIWQUctdLVadQiLSOR3zdJK03cJ27QqBhLZUOymLOhMEzJpjNxGUYEMR3lGM/s72-c/ESPN+Sports+API+-+WebSpeaks.in+2012-03-09+14-02-34.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-2063318667257401552</id><published>2012-03-09T00:33:00.000-08:00</published><updated>2012-05-20T22:39:41.255-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="ESPN"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Getting Started with ESPN Sports API</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Recently ESPN has launched its Sports API for getting all latest sports update and news. You can register for the API at &lt;a href=&quot;http://developer.espn.com/&quot; target=&quot;_blank&quot;&gt;http://developer.espn.com/&lt;/a&gt;. There you need to get an API key to create your application. The API is very simple and easy to use with a number of options. I have created a simple sports news gallery using the API. &lt;a href=&quot;http://demos.frnzzz.com/espn&quot; target=&quot;_blank&quot;&gt;See it working...&lt;/a&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm54rLSA5GSFO3MBjTtEQsRvCkopnJ6YQEvWVgrCCRK4sAUxpN76zpT0HlE0N3dOq_SliAGwh4AS0PRrpdIWQUctdLVadQiLSOR3zdJK03cJ27QqBhLZUOymLOhMEzJpjNxGUYEMR3lGM/s1600/ESPN+Sports+API+-+WebSpeaks.in+2012-03-09+14-02-34.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm54rLSA5GSFO3MBjTtEQsRvCkopnJ6YQEvWVgrCCRK4sAUxpN76zpT0HlE0N3dOq_SliAGwh4AS0PRrpdIWQUctdLVadQiLSOR3zdJK03cJ27QqBhLZUOymLOhMEzJpjNxGUYEMR3lGM/s320/ESPN+Sports+API+-+WebSpeaks.in+2012-03-09+14-02-34.png&quot; width=&quot;306&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/espn/&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://www.box.com/s/5hiofoz5z7zh4oqjgfcc&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&amp;nbsp;  &lt;br /&gt;&lt;h2&gt; &amp;nbsp;&lt;/h2&gt;&lt;h2&gt; &amp;nbsp;jQuery Code:&lt;/h2&gt;&lt;pre class=&quot;brush:javascript&quot;&gt;    $(document).ready(function(){&lt;br /&gt;        var news_limit = 5;&lt;br /&gt;        var news_offset = 0;&lt;br /&gt;&lt;br /&gt;        $(&#39;a#load_more&#39;).click(function(){&lt;br /&gt;            load_more_news();&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        function load_more_news(){&lt;br /&gt;            news_offset += news_limit;&lt;br /&gt;            $.ajax({ &lt;br /&gt;                url: &quot;http://api.espn.com/v1/sports/news/headlines&quot;, &lt;br /&gt;                data: { &lt;br /&gt;                    // enter your developer api key here &lt;br /&gt;                    apikey: &quot;&amp;lt;your_api_key&amp;gt;&quot;,&lt;br /&gt;                    // the type of data you&#39;re expecting back from the api &lt;br /&gt;                    _accept: &quot;application/json&quot;,&lt;br /&gt;                    // number of results to be shown&lt;br /&gt;                    limit: news_limit,&lt;br /&gt;                    offset: news_offset&lt;br /&gt;                }, &lt;br /&gt;                dataType: &quot;jsonp&quot;, &lt;br /&gt;                beforeSend: function(){&lt;br /&gt;                    $(&#39;#result&#39;).html(&#39;Loading...&#39;);&lt;br /&gt;                },&lt;br /&gt;                success: function(data) { &lt;br /&gt;                    $(&#39;#result&#39;).html(&#39;&#39;);&lt;br /&gt;                    // create an unordered list of headlines &lt;br /&gt;                    var ul = $(&#39;ul#list&#39;); &lt;br /&gt;                    $.each(data.headlines, function() { &lt;br /&gt;                     var htm = this.headline;&lt;br /&gt;                     htm += &#39;&amp;lt;a class=&quot;readmore&quot; href=&quot;&#39;+this.links.web.href+&#39;&quot; target=&quot;_blank&quot;&amp;gt;Read more&amp;lt;/a&amp;gt;&#39;;&lt;br /&gt;                        var li = $(&#39;&amp;lt;li/&amp;gt;&#39;).html(htm); &lt;br /&gt;                        ul.append(li) &lt;br /&gt;                    }); &lt;br /&gt;                }, &lt;br /&gt;                error: function() { &lt;br /&gt;                     // handle the error &lt;br /&gt;                } &lt;br /&gt;            });&lt;br /&gt;        }&lt;br /&gt;        load_more_news();&lt;br /&gt;    });&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    HTML Markup&lt;/h2&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;ESPN Sports API | WebSpeaks.in&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;div class=&quot;main&quot;&amp;gt;&lt;br /&gt;        &amp;lt;h2&amp;gt;Latest in Sports World&amp;lt;/h2&amp;gt;&lt;br /&gt;        &amp;lt;hr /&amp;gt;&lt;br /&gt;        &amp;lt;div class=&quot;news&quot;&amp;gt;&lt;br /&gt;            &amp;lt;div style=&quot;text-align:center&quot; id=&quot;result&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;            &amp;lt;div&amp;gt;&lt;br /&gt;                &amp;lt;ul id=&quot;list&quot;&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;            &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;hr /&amp;gt;&lt;br /&gt;        &amp;lt;div class=&quot;button&quot;&amp;gt;&amp;lt;a class=&quot;button white bigrounded&quot; id=&quot;load_more&quot;&amp;gt;Load More&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;    CSS Code:&lt;/h2&gt;&lt;pre class=&quot;brush:css&quot;&gt;@font-face {&lt;br /&gt; font-family: &quot;UglyQua&quot;;&lt;br /&gt; font-style: normal;&lt;br /&gt; src: url(UglyQua/UglyQua.eot); /*if IE */&lt;br /&gt; src: local(&quot;UglyQua&quot;), url(&quot;UglyQua/UglyQua.ttf&quot;) format(&quot;truetype&quot;); /* non-IE */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{&lt;br /&gt; margin:0px;&lt;br /&gt; padding:0px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;body{&lt;br /&gt; color:#888888;&lt;br /&gt; font-size:13px;&lt;br /&gt; background: #eeeeee;&lt;br /&gt; font-family: &quot;UglyQua&quot;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;hr{&lt;br /&gt; margin-top:10px;&lt;br /&gt; margin-bottom:10px;&lt;br /&gt; color:#eeeeee;&lt;br /&gt;}&lt;br /&gt;div.main{&lt;br /&gt; width:400px;&lt;br /&gt; margin: auto;&lt;br /&gt; padding: 10px;&lt;br /&gt;}&lt;br /&gt;h2{&lt;br /&gt; color:#888888;&lt;br /&gt; font-size:33px;&lt;br /&gt; padding:10px;&lt;br /&gt; text-shadow:2px 1px 6px #333;&lt;br /&gt;}&lt;br /&gt;div.news{&lt;br /&gt; width:400px;&lt;br /&gt; height:auto;&lt;br /&gt; height:415px;&lt;br /&gt; overflow: hidden;&lt;br /&gt; overflow-y: auto;&lt;br /&gt;}&lt;br /&gt;ul li{&lt;br /&gt; padding:8px;&lt;br /&gt; font-size:18px;&lt;br /&gt;}&lt;br /&gt;a.readmore {&lt;br /&gt;    color: #999999;&lt;br /&gt;    font-size: 60%;&lt;br /&gt;    padding-left: 10px;&lt;br /&gt;    text-decoration: underline;&lt;br /&gt;}&lt;br /&gt;div.button{&lt;br /&gt; text-align: center;&lt;br /&gt; padding: 10px;&lt;br /&gt;}&lt;br /&gt;a.button {&lt;br /&gt; display: inline-block;&lt;br /&gt; outline: none;&lt;br /&gt; cursor: pointer;&lt;br /&gt; text-align: center;&lt;br /&gt; text-decoration: none;&lt;br /&gt; font: 14px/100% Arial, Helvetica, sans-serif;&lt;br /&gt; padding: .5em 2em .55em;&lt;br /&gt; text-shadow: 0 1px 1px rgba(0,0,0,.3);&lt;br /&gt; -webkit-border-radius: .5em; &lt;br /&gt; -moz-border-radius: .5em;&lt;br /&gt; border-radius: .5em;&lt;br /&gt; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);&lt;br /&gt; -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);&lt;br /&gt; box-shadow: 0 1px 2px rgba(0,0,0,.2);&lt;br /&gt;}&lt;br /&gt;.white {&lt;br /&gt;  background-attachment:initial;&lt;br /&gt;  background-clip:initial;&lt;br /&gt;  background-color:initial;&lt;br /&gt;  background-image:-webkit-gradient(linear, 0 0%, 0 100%, from(#FFFFFF), to(#EDEDED));&lt;br /&gt;  background-origin:initial;&lt;br /&gt;  background-position:initial initial;&lt;br /&gt;  background-repeat:initial initial;&lt;br /&gt;  border-bottom-color:#B7B7B7;&lt;br /&gt;  border-bottom-style:solid;&lt;br /&gt;  border-bottom-width:1px;&lt;br /&gt;  border-left-color:#B7B7B7;&lt;br /&gt;  border-left-style:solid;&lt;br /&gt;  border-left-width:1px;&lt;br /&gt;  border-right-color:#B7B7B7;&lt;br /&gt;  border-right-style:solid;&lt;br /&gt;  border-right-width:1px;&lt;br /&gt;  border-top-color:#B7B7B7;&lt;br /&gt;  border-top-style:solid;&lt;br /&gt;  border-top-width:1px;&lt;br /&gt;  color:#606060;&lt;br /&gt;}&lt;br /&gt;.bigrounded {&lt;br /&gt;  border-bottom-left-radius:2em 2em;&lt;br /&gt;  border-bottom-right-radius:2em 2em;&lt;br /&gt;  border-top-left-radius:2em 2em;&lt;br /&gt;  border-top-right-radius:2em 2em;&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/2063318667257401552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/03/getting-started-with-espn-sports-api.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/2063318667257401552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/2063318667257401552'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/03/getting-started-with-espn-sports-api.html' title='Getting Started with ESPN Sports API'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm54rLSA5GSFO3MBjTtEQsRvCkopnJ6YQEvWVgrCCRK4sAUxpN76zpT0HlE0N3dOq_SliAGwh4AS0PRrpdIWQUctdLVadQiLSOR3zdJK03cJ27QqBhLZUOymLOhMEzJpjNxGUYEMR3lGM/s72-c/ESPN+Sports+API+-+WebSpeaks.in+2012-03-09+14-02-34.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-5211262344141262920</id><published>2012-02-26T06:19:00.001-08:00</published><updated>2012-05-20T22:39:41.292-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to"/><category scheme="http://www.blogger.com/atom/ns#" term="magento"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Create Custom Tab in Magento Product Add/Edit Page</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If you are trying to add a custom tab to the product add/edit page in Magento admin, then you are at the right place. Today I will tell you a damn simple method to add the custom tab to product add/edit page. We will have to add few lines to the xml layout file of your custom module. Then create a phtml file that contains the html part to be shown in the tab.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVjMprcM5Rxck-ajon3d38daacQN6loOJ1D1-5ho6PsXG62z4LqlZcNYc1adELA-UggoxEENlDsqHmUZqVBY2J4xpP7G7T18pmRPrBPdP2dX2cgyprwZvFu3atr5N01fYghM71fNdjIA/s1600/HTC+Dezire+-+Manage+Products+-+Catalog+-+Magento+Admin+2012-02-26+19-34-43.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVjMprcM5Rxck-ajon3d38daacQN6loOJ1D1-5ho6PsXG62z4LqlZcNYc1adELA-UggoxEENlDsqHmUZqVBY2J4xpP7G7T18pmRPrBPdP2dX2cgyprwZvFu3atr5N01fYghM71fNdjIA/s640/HTC+Dezire+-+Manage+Products+-+Catalog+-+Magento+Admin+2012-02-26+19-34-43.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;Here is the detailed description of the process:&lt;br /&gt;1. Create a directory named &#39;custom&#39; at app\design\adminhtml\default\default\template location.&lt;br /&gt;&lt;br /&gt;2. Create file named content.phtml in the above directory so that the full path looks like app\design\adminhtml\default\default\template\custom\content.phtml&lt;br /&gt;&lt;br /&gt;3. In content.phtml you can write any php and html code according to your need. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;//Get the current product&lt;br /&gt;$product = Mage::registry(&#39;product&#39;);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class=&quot;entry-edit&quot;&amp;gt;&lt;br /&gt;    &amp;lt;div class=&quot;entry-edit-head&quot;&amp;gt;&lt;br /&gt;        &amp;lt;h4 class=&quot;icon-head head-edit-form fieldset-legend&quot;&amp;gt;Custom Tab&amp;lt;/h4&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div id=&quot;group_fields4&quot; class=&quot;fieldset fieldset-wide&quot;&amp;gt;&lt;br /&gt; &amp;lt;?php&lt;br /&gt; var_dump($product);&lt;br /&gt; ?&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;4. Create the block file in app\code\local\&amp;lt;namespace&amp;gt;\&amp;lt;module_name&amp;gt;\Block\Adminhtml\Config.php. Add following content to the file: &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;class &amp;lt;namespace&amp;gt;_&amp;lt;module_name&amp;gt;_Block_Adminhtml_Config extends Mage_Core_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface&lt;br /&gt;{&lt;br /&gt; public function __construct(){&lt;br /&gt;  $this-&amp;gt;setTemplate(&#39;custom/content.phtml&#39;);&lt;br /&gt;  parent::__construct();&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; //Label to be shown in the tab&lt;br /&gt; public function getTabLabel(){&lt;br /&gt;  return Mage::helper(&#39;core&#39;)-&amp;gt;__(&#39;Custom Tab&#39;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public function getTabTitle(){&lt;br /&gt;  return Mage::helper(&#39;core&#39;)-&amp;gt;__(&#39;Custom Tab&#39;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public function canShowTab(){&lt;br /&gt;  return true;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public function isHidden(){&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;5. Open the app\design\adminhtml\default\default\layout\&amp;lt;module_name&amp;gt;.xml. Add following lines to this file: &lt;br /&gt;&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;!-- To add a tab on new product page --&amp;gt;&lt;br /&gt;&amp;lt;adminhtml_catalog_product_new&amp;gt;&lt;br /&gt; &amp;lt;reference name=&quot;product_tabs&quot;&amp;gt;&lt;br /&gt;  &amp;lt;action method=&quot;addTab&quot;&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;custom_tab&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;block template=&quot;custom/content.phtml&quot;&amp;gt;module_name/adminhtml_config&amp;lt;/block&amp;gt;&lt;br /&gt;  &amp;lt;/action&amp;gt;&lt;br /&gt; &amp;lt;/reference&amp;gt;&lt;br /&gt;&amp;lt;/adminhtml_catalog_product_new&amp;gt;&lt;br /&gt;&amp;lt;!-- To add a tab on new product page --&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- To add a tab on edit product page --&amp;gt;&lt;br /&gt;&amp;lt;adminhtml_catalog_product_edit&amp;gt;&lt;br /&gt; &amp;lt;reference name=&quot;product_tabs&quot;&amp;gt;&lt;br /&gt;  &amp;lt;action method=&quot;addTab&quot;&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;custom_tab&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;block template=&quot;custom/content.phtml&quot;&amp;gt;module_name/adminhtml_config&amp;lt;/block&amp;gt;&lt;br /&gt;  &amp;lt;/action&amp;gt;&lt;br /&gt; &amp;lt;/reference&amp;gt;&lt;br /&gt;&amp;lt;/adminhtml_catalog_product_edit&amp;gt;&lt;br /&gt;&amp;lt;!-- To add a tab on edit product page --&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;module_name&gt;This is all and you are done! Please share if you like it.&lt;/module_name&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/5211262344141262920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/02/create-custom-tab-in-magento-product_26.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/5211262344141262920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/5211262344141262920'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/02/create-custom-tab-in-magento-product_26.html' title='Create Custom Tab in Magento Product Add/Edit Page'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVjMprcM5Rxck-ajon3d38daacQN6loOJ1D1-5ho6PsXG62z4LqlZcNYc1adELA-UggoxEENlDsqHmUZqVBY2J4xpP7G7T18pmRPrBPdP2dX2cgyprwZvFu3atr5N01fYghM71fNdjIA/s72-c/HTC+Dezire+-+Manage+Products+-+Catalog+-+Magento+Admin+2012-02-26+19-34-43.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-4638075159744669176</id><published>2012-02-26T06:19:00.000-08:00</published><updated>2012-05-20T22:39:41.283-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to"/><category scheme="http://www.blogger.com/atom/ns#" term="magento"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Create Custom Tab in Magento Product Add/Edit Page</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If you are trying to add a custom tab to the product add/edit page in Magento admin, then you are at the right place. Today I will tell you a damn simple method to add the custom tab to product add/edit page. We will have to add few lines to the xml layout file of your custom module. Then create a phtml file that contains the html part to be shown in the tab.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVjMprcM5Rxck-ajon3d38daacQN6loOJ1D1-5ho6PsXG62z4LqlZcNYc1adELA-UggoxEENlDsqHmUZqVBY2J4xpP7G7T18pmRPrBPdP2dX2cgyprwZvFu3atr5N01fYghM71fNdjIA/s1600/HTC+Dezire+-+Manage+Products+-+Catalog+-+Magento+Admin+2012-02-26+19-34-43.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVjMprcM5Rxck-ajon3d38daacQN6loOJ1D1-5ho6PsXG62z4LqlZcNYc1adELA-UggoxEENlDsqHmUZqVBY2J4xpP7G7T18pmRPrBPdP2dX2cgyprwZvFu3atr5N01fYghM71fNdjIA/s640/HTC+Dezire+-+Manage+Products+-+Catalog+-+Magento+Admin+2012-02-26+19-34-43.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;Here is the detailed description of the process:&lt;br /&gt;1. Create a directory named &#39;custom&#39; at app\design\adminhtml\default\default\template location.&lt;br /&gt;&lt;br /&gt;2. Create file named content.phtml in the above directory so that the full path looks like app\design\adminhtml\default\default\template\custom\content.phtml&lt;br /&gt;&lt;br /&gt;3. In content.phtml you can write any php and html code according to your need. &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;//Get the current product&lt;br /&gt;$product = Mage::registry(&#39;product&#39;);&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class=&quot;entry-edit&quot;&amp;gt;&lt;br /&gt;    &amp;lt;div class=&quot;entry-edit-head&quot;&amp;gt;&lt;br /&gt;        &amp;lt;h4 class=&quot;icon-head head-edit-form fieldset-legend&quot;&amp;gt;Custom Tab&amp;lt;/h4&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div id=&quot;group_fields4&quot; class=&quot;fieldset fieldset-wide&quot;&amp;gt;&lt;br /&gt; &amp;lt;?php&lt;br /&gt; var_dump($product);&lt;br /&gt; ?&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;4. Create the block file in app\code\local\&amp;lt;namespace&amp;gt;\&amp;lt;module_name&amp;gt;\Block\Adminhtml\Config.php. Add following content to the file: &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;class &amp;lt;namespace&amp;gt;_&amp;lt;module_name&amp;gt;_Block_Adminhtml_Config extends Mage_Core_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface&lt;br /&gt;{&lt;br /&gt; public function __construct(){&lt;br /&gt;  $this-&amp;gt;setTemplate(&#39;custom/content.phtml&#39;);&lt;br /&gt;  parent::__construct();&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; //Label to be shown in the tab&lt;br /&gt; public function getTabLabel(){&lt;br /&gt;  return Mage::helper(&#39;core&#39;)-&amp;gt;__(&#39;Custom Tab&#39;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public function getTabTitle(){&lt;br /&gt;  return Mage::helper(&#39;core&#39;)-&amp;gt;__(&#39;Custom Tab&#39;);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public function canShowTab(){&lt;br /&gt;  return true;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public function isHidden(){&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;5. Open the app\design\adminhtml\default\default\layout\&amp;lt;module_name&amp;gt;.xml. Add following lines to this file: &lt;br /&gt;&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;!-- To add a tab on new product page --&amp;gt;&lt;br /&gt;&amp;lt;adminhtml_catalog_product_new&amp;gt;&lt;br /&gt; &amp;lt;reference name=&quot;product_tabs&quot;&amp;gt;&lt;br /&gt;  &amp;lt;action method=&quot;addTab&quot;&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;custom_tab&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;block template=&quot;custom/content.phtml&quot;&amp;gt;module_name/adminhtml_config&amp;lt;/block&amp;gt;&lt;br /&gt;  &amp;lt;/action&amp;gt;&lt;br /&gt; &amp;lt;/reference&amp;gt;&lt;br /&gt;&amp;lt;/adminhtml_catalog_product_new&amp;gt;&lt;br /&gt;&amp;lt;!-- To add a tab on new product page --&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- To add a tab on edit product page --&amp;gt;&lt;br /&gt;&amp;lt;adminhtml_catalog_product_edit&amp;gt;&lt;br /&gt; &amp;lt;reference name=&quot;product_tabs&quot;&amp;gt;&lt;br /&gt;  &amp;lt;action method=&quot;addTab&quot;&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;custom_tab&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;block template=&quot;custom/content.phtml&quot;&amp;gt;module_name/adminhtml_config&amp;lt;/block&amp;gt;&lt;br /&gt;  &amp;lt;/action&amp;gt;&lt;br /&gt; &amp;lt;/reference&amp;gt;&lt;br /&gt;&amp;lt;/adminhtml_catalog_product_edit&amp;gt;&lt;br /&gt;&amp;lt;!-- To add a tab on edit product page --&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;module_name&gt;This is all and you are done! Please share if you like it.&lt;/module_name&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/4638075159744669176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/02/create-custom-tab-in-magento-product.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/4638075159744669176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/4638075159744669176'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/02/create-custom-tab-in-magento-product.html' title='Create Custom Tab in Magento Product Add/Edit Page'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVjMprcM5Rxck-ajon3d38daacQN6loOJ1D1-5ho6PsXG62z4LqlZcNYc1adELA-UggoxEENlDsqHmUZqVBY2J4xpP7G7T18pmRPrBPdP2dX2cgyprwZvFu3atr5N01fYghM71fNdjIA/s72-c/HTC+Dezire+-+Manage+Products+-+Catalog+-+Magento+Admin+2012-02-26+19-34-43.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8848627081796627656.post-8835043441282638156</id><published>2012-02-23T02:05:00.001-08:00</published><updated>2012-05-20T22:39:41.347-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="facebook api"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="web 2.0"/><title type='text'>Create Album and Upload Photo to Facebook Fan Page using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;In this series of Facebook API tutorials, today we will continue with creating albums on Facebook Fan Page. The main meat of this tutorial is getting the right access token for your fan page. To get the right access token, follow these steps:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Go to https://developers.facebook.com/tools/explorer?method=GET&amp;amp;path=me%2Faccounts&amp;nbsp;&lt;/li&gt;&lt;li&gt;Enter https://graph.facebook.com/me/accounts in the second text box&amp;nbsp;&lt;/li&gt;&lt;li&gt;Click on submit&amp;nbsp;&lt;/li&gt;&lt;li&gt;Json data will be returned&amp;nbsp;&lt;/li&gt;&lt;li&gt;From that select the access token of your Fan page.&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Other Facebook Tutorials:&lt;br /&gt;&lt;a href=&quot;http://www.webspeaks.in/2011/12/upload-photos-to-facebook-fan-page.html&quot;&gt;How to upload photos to you Facebook Fan Page&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.webspeaks.in/2011/09/access-faceook-photo-albums-using-php.html&quot;&gt;Access Facebook Photo Albums using PHP - v1.0&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.webspeaks.in/2011/08/upload-photos-on-facebook-using-php.html&quot;&gt;Upload photos on Facebook using PHP&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://demos.frnzzz.com/fbAlbum/create_n_upload_to_fanpage.php&quot; target=&quot;_blank&quot;&gt;See it working&lt;/a&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;a class=&quot;demo&quot; href=&quot;http://demos.frnzzz.com/fbAlbum/create_n_upload_to_fanpage.php&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt;&amp;nbsp;&lt;a class=&quot;download&quot; href=&quot;http://www.box.com/s/90bqt30bcd0p6uku5l73&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt; &lt;br /&gt;&lt;pre class=&quot;brush:php&quot;&gt;&amp;lt;?php&lt;br /&gt;require_once &#39;library/facebook.php&#39;;&lt;br /&gt;$facebook = new Facebook(array(&lt;br /&gt; &#39;appId&#39;  =&amp;gt; &#39;&amp;lt;app_id&amp;gt;&#39;,&lt;br /&gt; &#39;secret&#39; =&amp;gt; &#39;&amp;lt;app_sercret&amp;gt;&#39;,&lt;br /&gt; &#39;fileUpload&#39; =&amp;gt; true&lt;br /&gt;));&lt;br /&gt;?&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;WebSpeaks.in | Create album and upload photos to Facebook Fan Page&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;//It can be found at https://developers.facebook.com/tools/access_token/&lt;br /&gt;$access_token = &#39;&amp;lt;you_access_token&amp;gt;&#39;;&lt;br /&gt;&lt;br /&gt;$params = array(&#39;access_token&#39; =&amp;gt; $access_token);&lt;br /&gt;&lt;br /&gt;//The id of the fanpage&lt;br /&gt;$fanpage = &#39;&amp;lt;your_fan_page_id&amp;gt;&#39;;&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt; * Go to https://developers.facebook.com/tools/explorer?method=GET&amp;amp;path=me%2Faccounts&lt;br /&gt; * Enter https://graph.facebook.com/me/accounts in the second text box&lt;br /&gt; * Click on submit&lt;br /&gt; * Json data will be returned&lt;br /&gt; * From that select the access token of your Fan page&lt;br /&gt;*/&lt;br /&gt;$page_access_token = &#39;&amp;lt;your_page_access_token&amp;gt;&#39;;&lt;br /&gt;$facebook-&amp;gt;setAccessToken($page_access_token);&lt;br /&gt;&lt;br /&gt;$facebook-&amp;gt;setFileUploadSupport(true);&lt;br /&gt;&lt;br /&gt;//Create an album&lt;br /&gt;$album_details = array(&lt;br /&gt;        &#39;message&#39;=&amp;gt; &#39;Test album&#39;,&lt;br /&gt;        &#39;name&#39;=&amp;gt; &#39;Album name&#39;.date(&#39;Y-m-d H:i:s&#39;) //should be unique each time&lt;br /&gt;);&lt;br /&gt;$album = $facebook-&amp;gt;api(&#39;/&#39;.$fanpage.&#39;/albums&#39;, &#39;post&#39;, $album_details);&lt;br /&gt;&lt;br /&gt;//The id of the album&lt;br /&gt;$album_id =$album[&#39;id&#39;];&lt;br /&gt;&lt;br /&gt;//Replace arvind07 with your Facebook ID&lt;br /&gt;$accounts = $facebook-&amp;gt;api(&#39;/arvind07/accounts&#39;, &#39;GET&#39;, $params);&lt;br /&gt;&lt;br /&gt;foreach($accounts[&#39;data&#39;] as $account) {&lt;br /&gt; if( $account[&#39;id&#39;] == $fanpage || $account[&#39;name&#39;] == $fanpage ){&lt;br /&gt;  $fanpage_token = $account[&#39;access_token&#39;];&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$valid_files = array(&#39;image/jpeg&#39;, &#39;image/png&#39;, &#39;image/gif&#39;);&lt;br /&gt;&lt;br /&gt;if(isset($_FILES) &amp;amp;&amp;amp; !empty($_FILES)){&lt;br /&gt; if( !in_array($_FILES[&#39;pic&#39;][&#39;type&#39;], $valid_files ) ){&lt;br /&gt;  echo &#39;Only jpg, png and gif image types are supported!&#39;;&lt;br /&gt; }else{&lt;br /&gt;  #Upload photo here&lt;br /&gt;  $img = realpath($_FILES[&quot;pic&quot;][&quot;tmp_name&quot;]);&lt;br /&gt;&lt;br /&gt;  $args = array(&lt;br /&gt;   &#39;message&#39; =&amp;gt; &#39;This photo was uploaded via WebSpeaks.in&#39;,&lt;br /&gt;   &#39;image&#39; =&amp;gt; &#39;@&#39; . $img,&lt;br /&gt;   &#39;aid&#39; =&amp;gt; $album_id,&lt;br /&gt;   &#39;no_story&#39; =&amp;gt; 0,&lt;br /&gt;   &#39;access_token&#39; =&amp;gt; $fanpage_token&lt;br /&gt;  );&lt;br /&gt;&lt;br /&gt;  $photo = $facebook-&amp;gt;api($album_id . &#39;/photos&#39;, &#39;post&#39;, $args);&lt;br /&gt;  if( is_array( $photo ) &amp;amp;&amp;amp; !empty( $photo[&#39;id&#39;] ) ){&lt;br /&gt;   echo &#39;&amp;lt;p&amp;gt;&amp;lt;a target=&quot;_blank&quot; href=&quot;http://www.facebook.com/photo.php?fbid=&#39;.$photo[&#39;id&#39;].&#39;&quot;&amp;gt;Click here to watch this photo on Facebook.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&#39;;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt; &amp;lt;!-- Form for uploading the photo --&amp;gt;&lt;br /&gt; &amp;lt;div class=&quot;main&quot;&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;Select a photo to upload on Facebook Fan Page&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;form method=&quot;post&quot; action=&quot;&amp;lt;?php echo $_SERVER[&#39;PHP_SELF&#39;]; ?&amp;gt;&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;Select the image: &amp;lt;input type=&quot;file&quot; name=&quot;pic&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;input class=&quot;post_but&quot; type=&quot;submit&quot; value=&quot;Create album and Upload&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;/form&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arvind-07.blogspot.com/feeds/8835043441282638156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://arvind-07.blogspot.com/2012/02/create-album-and-upload-photo-to_23.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8835043441282638156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8848627081796627656/posts/default/8835043441282638156'/><link rel='alternate' type='text/html' href='http://arvind-07.blogspot.com/2012/02/create-album-and-upload-photo-to_23.html' title='Create Album and Upload Photo to Facebook Fan Page using PHP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/05362733369512745009</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry></feed>