<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Web development notes</title> <atom:link href="http://dev.codinglog.com/feed/" rel="self" type="application/rss+xml" /><link>http://dev.codinglog.com</link> <description>Just some random coding stuff</description> <lastBuildDate>Sun, 12 Feb 2012 14:54:21 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Overlay js</title><link>http://dev.codinglog.com/jquery/overlay-js/</link> <comments>http://dev.codinglog.com/jquery/overlay-js/#comments</comments> <pubDate>Sun, 12 Feb 2012 12:52:45 +0000</pubDate> <dc:creator>mtsandeep</dc:creator> <category><![CDATA[jquery]]></category> <guid
isPermaLink="false">http://dev.codinglog.com/?p=59</guid> <description><![CDATA[Version 2 (published on Feb 12 2012) Overlay js is a lightweight overlay jQuery plugin. It only weighs 2kb minified. You can style the overlay completely with css. I have added 3 callback functions in new version to help with &#8230; <a
href="http://dev.codinglog.com/jquery/overlay-js/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><strong>Version 2 (published on Feb 12 2012)</strong></p><p>Overlay js is a lightweight overlay jQuery plugin. It only weighs 2kb minified. You can style the overlay completely with css. I have added 3 callback functions in new version to help with the overlay. You can now call a function before launching the overlay, after the overlay has completed loaded and after overlay is removed/closed. Please refer to the demo for example usage and preview.</p><p>Current version: 2<br
/> License: MIT license<br
/> Download location: <a
href="https://bitbucket.org/mtsandeep/overlay/downloads/mtsandeep-overlay-js-v2.zip">overlay-js 2</a><br
/> Demo : <a
title="overlay js demo" href="http://demos.codinglog.com/jquery/overlay-js/" target="_blank">http://demos.codinglog.com/jquery/overlay-js/</a></p><p>bitbucket repository: <a
title="overlay js bitbucket repository" href="https://bitbucket.org/mtsandeep/overlay/" target="_blank">https://bitbucket.org/mtsandeep/overlay/</a></p><blockquote><p><strong>VERSION 0.2 (published on Sep 11, 2011)</strong></p><p>Overlay js is my first jquery plugin. I needed a simple overlay and i wanted the styling to be from my css, so i made this plugin. Its lightweight, only 1.75kb minified.</p><p>As this is my first plugin, it may not be the best coded plugin, so please test it and help me improve it. I have made a bitbucket repository so that anyone can fork it and improve it. Please check the example folder in the download for usage instructions.</p></blockquote> ]]></content:encoded> <wfw:commentRss>http://dev.codinglog.com/jquery/overlay-js/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Ajax form submission and validation with jquery in codeigniter</title><link>http://dev.codinglog.com/codeigniter/ajax-form-submission-and-validation-with-jquery-in-codeigniter/</link> <comments>http://dev.codinglog.com/codeigniter/ajax-form-submission-and-validation-with-jquery-in-codeigniter/#comments</comments> <pubDate>Sun, 10 Jul 2011 04:35:50 +0000</pubDate> <dc:creator>mtsandeep</dc:creator> <category><![CDATA[codeigniter]]></category> <category><![CDATA[ajax]]></category> <category><![CDATA[forms]]></category> <category><![CDATA[jquery]]></category> <guid
isPermaLink="false">http://dev.codinglog.com/?p=53</guid> <description><![CDATA[I use jquery in almost all websites i make, so now i tried to have some ajax to the forms of my website. I didn&#8217;t use any libraries (i heard there are some libraries for ajax in codeigniter, but i &#8230; <a
href="http://dev.codinglog.com/codeigniter/ajax-form-submission-and-validation-with-jquery-in-codeigniter/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I use jquery in almost all websites i make, so now i tried to have some ajax to the forms of my website.</p><p>I didn&#8217;t use any libraries (i heard there are some libraries for ajax in codeigniter, but i decided to go with this method), so make some jquery functions to take the data from the form and submit it to the controller using jquery&#8217;s ajax functions. ($.post in particular). but after writing all the ajax queries i realized that i need a validation also. so saw simple jquery validation and it also have an option to enable ajax. (all my coding just got wasted <img
src='http://dev.codinglog.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). so i used that along with this. so here is the code</p><p>At first i made a simple form with the below structure</p><pre class="brush: xml; title: ; notranslate">
	&lt;form action=&quot;&lt;?php echo site_url('user/login');?&gt;&quot; method=&quot;POST&quot;&gt;
		&lt;fieldset&gt;
			&lt;legend&gt;User Login:&lt;/legend&gt;
			&lt;ul&gt;
				&lt;li&gt;&lt;label for=&quot;username&quot;&gt;username:&lt;/label&gt;&lt;input name=&quot;username&quot; type=&quot;text&quot; id=&quot;username&quot; value=&quot;&quot; /&gt;&lt;/li&gt;
				&lt;li&gt;&lt;label for=&quot;password&quot;&gt;password:&lt;/label&gt;&lt;input name=&quot;password&quot; type=&quot;password&quot; id=&quot;password&quot; value=&quot;&quot; /&gt;&lt;/li&gt;
				&lt;li&gt;&lt;label for=&quot;submit&quot;&gt;Submit Button:&lt;/label&gt; &lt;input class=&quot;submit&quot; type=&quot;submit&quot; id=&quot;ajax_submit&quot; value=&quot;Submit&quot; /&gt;&lt;/li&gt;
			&lt;/ul&gt;
		&lt;/fieldset&gt;
	&lt;/form&gt;
&lt;div id=&quot;result&quot;&gt;&lt;/div&gt;
</pre><p>A few things you need to look in this structure is the &#8220;action&#8221;, make sure you have an action specified in-order to submit the data of the form or to work even if javascript is disabled. And also the &#8220;id&#8221; of the submit button, we are listening to the click on this submit button, so make sure you have the id is &#8220;ajax_submit&#8221;.<br
/> Now we have some jquery to help us with that submission.</p><pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
$(function() {
$('#ajax_submit').closest('form').simpleValidate({
  errorElement: 'em',
  ajaxRequest: true,
  completeCallback: function(validated_data) {
  var formData = validated_data.serialize();
	$.post(
		$('#ajax_submit').closest('form').attr('action'),
		formData,
		function(data){
			$('#result').html(data);
		},
		'html'
	);
  }
});
});
	&lt;/script&gt;
</pre><p>if anyone need code without validation</p><pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
	$(function() {
		$('#ajax_submit').click(function(e){
			e.preventDefault();
			$.post(
				$(this).closest('form').attr('action'),
				$(this).closest('form').serialize(),
				function(data){
					$('#result').html(data);
				},
				'html'
			);
		});
	});
&lt;/script&gt;
</pre><p>Load the simple jquery validation and jquery on top of this.</p><p>Now whenever user hits the ajax_submit button everything gets passed to the action url and data is loaded to the result div.</p><p>Take the data in your controller as usual and echo the result or alert</p> ]]></content:encoded> <wfw:commentRss>http://dev.codinglog.com/codeigniter/ajax-form-submission-and-validation-with-jquery-in-codeigniter/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Tracking multiple facebook like buttons and like boxes (using edge.create)</title><link>http://dev.codinglog.com/facebook/tracking-multiple-facebook-like-buttons-and-like-boxes-using-edge-create/</link> <comments>http://dev.codinglog.com/facebook/tracking-multiple-facebook-like-buttons-and-like-boxes-using-edge-create/#comments</comments> <pubDate>Sat, 14 May 2011 03:54:11 +0000</pubDate> <dc:creator>mtsandeep</dc:creator> <category><![CDATA[facebook]]></category> <guid
isPermaLink="false">http://dev.codinglog.com/?p=41</guid> <description><![CDATA[Facebook api provides &#8220;FB.Event.Subscribe&#8221; for subscribing to some events, in which &#8220;edge.create&#8221; and &#8220;edge.remove&#8221; are fired when user likes and unlikes a like button or likebox. (only works with xfbml version of like buttons/ like boxes) The example provided at &#8230; <a
href="http://dev.codinglog.com/facebook/tracking-multiple-facebook-like-buttons-and-like-boxes-using-edge-create/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Facebook api provides &#8220;<a
href="http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/">FB.Event.Subscribe</a>&#8221; for subscribing to some events, in which &#8220;edge.create&#8221; and &#8220;edge.remove&#8221; are fired when user likes and unlikes a like button or likebox. (only works with xfbml version of like buttons/ like boxes)</p><p>The example provided at facebook documentation is</p><pre class="brush: jscript; title: ; notranslate">
FB.Event.subscribe('edge.create', function(response) {
  // do something with response
});
</pre><p>A typical fb like button xfbml code is</p><pre class="brush: php; title: ; notranslate">
&lt;fb:like href=&quot;http://mtsandeep.com&quot; send=&quot;true&quot; width=&quot;450&quot; show_faces=&quot;true&quot; font=&quot;&quot;&gt;&lt;/fb:like&gt;
</pre><p>You can see that we can have &#8220;href&#8221;, the link we would like to get likes for. if its left empty, the current url of the page is taken as the value. We can use &#8220;edge.create&#8221; to see when a user likes the above page. but when we have more than one like buttons, we are not able to identify which like triggered. so to track the likes individually, we need to use the &#8220;href&#8221; value which is the only varying part of the like button code.</p><p>so here is the fb edge.create code</p><pre class="brush: jscript; title: ; notranslate">
FB.Event.subscribe('edge.create', function(href) { //href used instead of response
  if(href==&quot;http://mtsandeep.com&quot;) {
	  alert(&quot;user liked mtsandeep.com&quot;);
  }
  else {
	  alert(&quot;user liked some other button&quot;);
  }
});
</pre><p>You can view a small <a
href="http://demos.codinglog.com/facebook/multiple-like-buttons.php">demo here</a></p> ]]></content:encoded> <wfw:commentRss>http://dev.codinglog.com/facebook/tracking-multiple-facebook-like-buttons-and-like-boxes-using-edge-create/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Login with facebook email using facebook api</title><link>http://dev.codinglog.com/facebook/facebook-api-for-login/</link> <comments>http://dev.codinglog.com/facebook/facebook-api-for-login/#comments</comments> <pubDate>Sat, 30 Apr 2011 10:50:20 +0000</pubDate> <dc:creator>mtsandeep</dc:creator> <category><![CDATA[facebook]]></category> <guid
isPermaLink="false">http://dev.codinglog.com/?p=27</guid> <description><![CDATA[]]></description> <content:encoded><![CDATA[<pre class="brush: xml; title: ; notranslate">
&lt;a href=&quot;#&quot; id=&quot;facebook-login&quot;&gt;Login with facebook&lt;/a&gt;
&lt;p id=&quot;result&quot;&gt;&lt;/p&gt;
</pre><pre class="brush: jscript; title: ; notranslate">
&lt;script src=&quot;http://connect.facebook.net/en_US/all.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	 FB.init({
		appId:'your app key',
		cookie:true,
		status:true,
		xfbml:true
	 });
	$(document).ready(function() {
		$(&quot;#facebook-login&quot;).click(function(event) {
			event.preventDefault();
			FB.login(function(response) {
			  if (response.session) {
				if (response.perms) {
					// user is logged in and granted some permissions.
					// perms is a comma separated list of granted permissions
					FB.api('/me?fields=name,email', function (response) {
						var fb_name=response.name;
						var fb_email=response.email;
						var loadUrl=&quot;path to your login verification script&quot;;
						$.post( loadUrl, {email: fb_email}, function(status) {
							if(status==&quot;success&quot;){
								$('#result').html(&quot;You have successfully logged in with your facebook account&quot;);
							}
							else {
								$('#result').html(&quot;User haven't registered yet!&quot;);
							}
						});
					});
				}
				else {
				  $('#result').html(&quot;user is logged in, but did not grant any permissions&quot;);
				}
			  }
			  else {
				$('#result').html(&quot;user is not logged in&quot;);
			  }
			}, {perms:'email,status_update,publish_stream'});
		});
	});
&lt;/script&gt;
</pre>]]></content:encoded> <wfw:commentRss>http://dev.codinglog.com/facebook/facebook-api-for-login/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Pagination in codeignitor</title><link>http://dev.codinglog.com/codeigniter/pagination-in-codeignitor/</link> <comments>http://dev.codinglog.com/codeigniter/pagination-in-codeignitor/#comments</comments> <pubDate>Wed, 27 Apr 2011 21:36:27 +0000</pubDate> <dc:creator>mtsandeep</dc:creator> <category><![CDATA[codeigniter]]></category> <guid
isPermaLink="false">http://dev.codinglog.com/?p=4</guid> <description><![CDATA[This is an example of generating and displaying pagination in codeigniter. For Controller For model For view]]></description> <content:encoded><![CDATA[<p>This is an example of generating and displaying pagination in codeigniter.</p><p>For Controller</p><pre class="brush: php; title: ; notranslate">
public function display_list(){
$this-&gt;load-&gt;library('pagination');
$config['base_url'] = base_url().'lists/display_list/'; //your url where the content is displayed
$config['total_rows'] = $this-&gt;db-&gt;count_all('TABLE_NAME'); //counting the total no of rows in your table
$config['per_page'] = '10';
$config['num_links'] = '5';
$config['full_tag_open'] = '&lt;p&gt;';
$config['full_tag_close'] = '&lt;/p&gt;';
$this-&gt;pagination-&gt;initialize($config);
$data['offset_no']=$this-&gt;uri-&gt;segment(3);
$this-&gt;load-&gt;model('model_name');
$data['lists'] = $this-&gt;model_name-&gt;get_list($config['per_page'],$data['offset_no']);
$this-&gt;load-&gt;view('lists/display',$data); // the view file name and data to pass
}
</pre><p>For model</p><pre class="brush: php; title: ; notranslate">
function get_list($limit, $offset) {
$this-&gt;db-&gt;order_by(&quot;ID&quot;, &quot;asc&quot;);
$query = $this-&gt;db-&gt;get('TABLE_NAME', $limit, $offset);
return $query-&gt;result_array();
}
</pre><p>For view</p><pre class="brush: php; title: ; notranslate">
&lt;?php echo $this-&gt;pagination-&gt;create_links(); //pagination links ?&gt;
&lt;?php if(count($lists)&gt;0):?&gt;
	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Sl.No&lt;/th&gt;
			&lt;th&gt;Field name 1&lt;/th&gt;
			&lt;th&gt;Field name 2&lt;/th&gt;
			&lt;th&gt;Field name 3&lt;/th&gt;
		&lt;/tr&gt;
		&lt;?php for($i=0;$i&lt;count($lists);$i++):?&gt;
		&lt;tr&gt;
			 &lt;td&gt;&lt;?=$i+$offset_no+1?&gt;&lt;/td&gt;
			 &lt;td&gt;&lt;?=$lists[$i]['FIELD_NAME1']?&gt;&lt;/td&gt;
			 &lt;td&gt;&lt;?=$lists[$i]['FIELD_NAME2']?&gt;&lt;/td&gt;
			 &lt;td&gt;&lt;?=$lists[$i]['FIELD_NAME3']?&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;?php endfor;?&gt;
	&lt;/table&gt;
		&lt;?php else:?&gt;
			&lt;h2&gt;No list to display.&lt;/h2&gt;
&lt;?php endif;?&gt;
</pre>]]></content:encoded> <wfw:commentRss>http://dev.codinglog.com/codeigniter/pagination-in-codeignitor/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
