<?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>El Blog del Antonio &#187; Javascript</title>
	<atom:link href="http://www.ramirezcobos.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ramirezcobos.com</link>
	<description>Programming Web with PHP, CSS, Javascript and ∞</description>
	<lastBuildDate>Wed, 28 Dec 2011 18:26:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Offertutti</title>
		<link>http://www.ramirezcobos.com/2011/07/28/offertutti/</link>
		<comments>http://www.ramirezcobos.com/2011/07/28/offertutti/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 11:56:37 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Portfolio]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=886</guid>
		<description><![CDATA[Coupon aggregator site I worked for. Duties I had for the company:
Consulting
CSS redesign
XML feeds development -Automation with PHP
RSS development and automatic marketing integration with Twitter and Facebook
&#160;
Even though was not a Yii-job, I am more than happy to promote www.offertutti.com  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/2011/07/28/offertutti/screen-shot-2011-07-28-at-1-40-13-pm/" rel="attachment wp-att-887"><img class="alignright size-medium wp-image-887" title="Offertutti" src="http://www.ramirezcobos.com/wp-content/uploads/2011/07/Screen-Shot-2011-07-28-at-1.40.13-PM-300x223.png" alt="" width="300" height="223" /></a>Coupon aggregator site I worked for. Duties I had for the company:</p>
<ul>
<li>Consulting</li>
<li>CSS redesign</li>
<li>XML feeds development -Automation with PHP</li>
<li>RSS development and automatic marketing integration with Twitter and Facebook</li>
</ul>
<p>&nbsp;</p>
<p>Even though was not a Yii-job, I am more than happy to promote <a title="Offertutti" href="http://www.offertutti.com">www.offertutti.com</a> here as one of the most pleasant jobs I have ever had in my, already long -gosh how time pass, coding career.</p>
<p>The job was quite challenging, as any site developed by companies from certain countries, but managed to fulfill most of their expectations. Even though I am currently in the middle of a dream project, it continues to be a pleasure to help them out every now and then.</p>
<p>New design is coming&#8230;</p>
<a href="http://twitter.com/?status=RT%20%40%3A%20Offertutti%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2011%2F07%2F28%2Foffertutti%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2011/07/28/offertutti/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Livebuttons Plugin</title>
		<link>http://www.ramirezcobos.com/2010/12/15/jquery-livebuttons-plugin/</link>
		<comments>http://www.ramirezcobos.com/2010/12/15/jquery-livebuttons-plugin/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 15:45:23 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=716</guid>
		<description><![CDATA[Introduction
I normally develop CMS (control management systems) based on a heavy use of AJAX, and I normally endup writing tones of jQuery functions for different IDs and/or CLASSes. Thinking to create a library that will free me to create the same functions again and again and for different  [...]]]></description>
			<content:encoded><![CDATA[<h2><a rel="attachment wp-att-372" href="http://www.ramirezcobos.com/2010/01/14/jquery-1-4-are-you-ready/picture-121-300x157/"><img class="alignright size-thumbnail wp-image-372" title="jQuery" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-121-300x157-120x120.png" alt="" width="120" height="120" /></a>Introduction</h2>
<p>I normally develop CMS (control management systems) based on a heavy use of AJAX, and I normally endup writing tones of jQuery functions for different IDs and/or CLASSes. Thinking to create a library that will free me to create the same functions again and again and for different classes I thought about this simple plugin. The reason was that if I was to create a new CMS for my beloved Yii framework, I just wanted to have a system where, by setting some meta data into the HTML elements, the client script will smartly know what to do. I didn&#8217;t want to necessary worry about different classes on  my client scripts, I wanted to be just one class.</p>
<p>The idea behind goes a bit further and has something to do with Yii, I want to create extensions that will take care of the correct rendering of a button without having to worry about the client scripts **and** also the same extension could actually call jquery commands easily. I emphasized **and** because Yii already provides an ajaxLink and an ajaxButton but they are not listened to perform client jquery executions and that, as seen in its forums, is causing problems to PHP programmers a lot of times.</p>
<p>Also, I envision an environment where through this, Yii extension designers will be able to create CMS styles, completely different that the one coming from Yii, so Yii users could easily integrate a new layout without even tweaking CSS, or Themes, or Layouts, just their views and by integrating some specialized widgets API, user will be able to program a gallery (for example) with just one line of code on their views. Enough talking, here is the plugin for you to test it and tell me what do you think.</p>
<h2>How to use</h2>
<p>Include jquery and jquery.livebuttons.js on your document&#8217;s head and start monitoring for livebuttons like this:</p>
<pre class="brush: jscript; title: ; notranslate">
//
// .selector is the class name the HTML elements have
$('.selector').livebuttons();
$('.selector').livebuttons( options );
//
// we can have more than one
$('.otherselector').livebuttons( otheroptions );
</pre>
<h2>Options</h2>
<h3>useFirebug</h3>
<p>A useful property for debuggin processes. If set to true all logs will be displayed on firebug console (or chrome).</p>
<pre class="brush: jscript; title: ; notranslate">
var options = {
    useFirebug: true
}
$('.selector').livebuttons( options );
</pre>
<h3>events</h3>
<p>An array of options where to specify the events to monitor. In future releases, we will be able to specify which methods correspond for certain events.</p>
<pre class="brush: jscript; title: ; notranslate">
var options = {
    events: ['click','mouseover'] // not a good practice though *yet*
}
$('.selector').livebuttons( options );
</pre>
<h3>methods</h3>
<p>This is the most interesting part of the plugin. We could implement our own javascript methods to be used with livebuttons. All methods will receive a &#8216;command&#8217; parameter, which is actually the object in the meta-data of the HTML element (see below on the examples provided for default methods).</p>
<pre class="brush: jscript; title: ; notranslate">
var options = {
    methods: {
        alert: function( command ) {
              alert( command.message );
        }
   }
}
$('.selector').livebuttons( options );
</pre>
<p>When designing our own javascript functions to be attached to the plugin, we can access internal parser functions with <strong>this</strong> keyboard. All functions receive a command object and also a reference to the <strong>options</strong> object. This object have a reference to the parser it self and we could easily access parser&#8217;s functions by using <strong>this.parser</strong>.</p>
<h2>The Parser</h2>
<p>If you look at the code inside the plugin, you will see that the parser has a couple of good methods to use:</p>
<h3>stringify</h3>
<p>Converts an object to its JSON representation string</p>
<h3>createIFrame</h3>
<p>Creates an iframe to be used with FORMs with multipart/form-data. So you can easily send files to the server without the need of reloading the page. Check at its code to see its</p>
<h3>removeIFrame</h3>
<p>Removes the iFrame previously created with parser.createIFrame() method.</p>
<h3>parseJSON</h3>
<p>Parses a JSON string and converts it into an object. I know jQuery comes with one, but it throws an error when you include a function into a command object&#8217;s property.</p>
<h2>Default Methods</h2>
<p>You have a couple of methods that already come with the plugin. You can easily override them if required. Here they are:</p>
<h3>ajax</h3>
<p>Its name is self-explanatory. It receives a command object on the following format:</p>
<pre>
{method:'ajax',url:'',data:{},success:function(){},error:function(){}}</pre>
<p><strong>Example of live button markup</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;a class=&quot;livebutton&quot; href=&quot;#&quot;
data-cmd='{&quot;method&quot;:&quot;ajax&quot;,&quot;url&quot;:'http://localhost/',&quot;success&quot;:handleAJAX}&quot;&gt;test ajax&lt;/a&gt;
</pre>
<h3>getscript</h3>
<p>Its calling jQuery&#8217;s getScript method. It receives a command object on the following format:</p>
<pre>
{method:'getscript',url:''}</pre>
<p><strong>Example of live button markup</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;a href=&quot;#&quot; class=&quot;livebutton&quot;
   data-cmd='{method:&quot;getscript&quot;,url:'http://localhost/script.js'}' &gt;test getscript&lt;/a&gt;
</pre>
<h3>jquery</h3>
<p>Its calling any jQuery&#8217;s method. It receives a command object on the following format:</p>
<pre>
{"method":"jquery","jqmethod": "","target":"","arguments":["url",function(){}]}</pre>
<p><strong>Example of live button markup</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;a class=&quot;livebutton&quot; href=&quot;#&quot; data-cmd=&quot;{&quot;method&quot;:&quot;jquery&quot;,&quot;jqmethod&quot;:&quot;load&quot;,&quot;target&quot;:&quot;#layer&quot;,&quot;arguments&quot;:[&quot;url&quot;:&quot;http://localhost&quot;]&quot;&gt;test load jquery function&lt;/a&gt;
</pre>
<h2>Remarks</h2>
<p>As previously said, all functions also receive the command object extracted from the HTML element, but that&#8217;s not all. The parser automatically includes a jquery reference of the HTML element to the command&#8217;s element property.</p>
<pre class="brush: jscript; title: ; notranslate">
var options = {
    methods: {
        alert: function( command ) {
              alert( command.message );
             // do not use $( command.element ) as it would like $( $( element ) )
              command.element.attr('title','I have already been clicked');
        }
   }
}
$('.selector').livebuttons( options );
</pre>
<h2>Demo</h2>
<p>For the sake of having a demo (I will build a better one) the following script will create a live button that can perform jquery &#8216;append&#8217; commands. Please note that when you load new content via AJAX on a page that has the livebuttons plugin that you have successfuly initiated, the plugin will also listen to the specified events to those livebuttons loaded via AJAX.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
&lt;script src=&quot;path\to\jquery.livebuttons.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$('.testbuttons').livebuttons();
&lt;body&gt;
&lt;a href=&quot;#&quot; class=&quot;testbuttons&quot;
  data-cmd=&quot;{&quot;method&quot;:&quot;jquery&quot;,&quot;jqmethod&quot;:&quot;append&quot;,&quot;target&quot;:&quot;#container&quot;,&quot;arguments&quot;:[&quot;new content&lt;br&gt;&quot;]}&quot;&gt;Test append&lt;/a&gt;
&lt;div id=&quot;container&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h2>Download</h2>
<p>I seriously would like to know what do you think about this system as, again, I am planning to develop extensions for Yii that will embrace it in order to easy the tasks of PHP programmers with client Javascript. I do use this system to create a new system for a personal project and it is working quite good; but I won&#8217;t dare to create Yii extensions if you think that what I envision is wrong.</p>
<p>If the below link doesn&#8217;t work (it happens normally because you are not registered), please use the following link to download: <a href="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/upload/jquery.livebuttons.js">jquery.livebuttons.js</a>.</p>
<div style="padding: 10px; text-align: center; background-color: #ffffff; border: 3px solid #dddddd;"><table style="border: 1px solid #CCC;" cellpadding="3" width="100%">
  <tr>
    <td width="35">
      <img src="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif" alt="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif">
    </td>
    <td>
      <b>download:</b> <a href="http://www.ramirezcobos.com/?file_id=16">JQuery Livebuttons Plugin</a> <small>(15.33KB)</small><br />
      <b>added:</b> 15/12/2010 <br />
      <b>clicks:</b> 171 <br />
    </td>
  </tr>
</table></div>
<p><center><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</center></p>
<a href="http://twitter.com/?status=RT%20%40%3A%20jQuery%20Livebuttons%20Plugin%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F12%2F15%2Fjquery-livebuttons-plugin%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/12/15/jquery-livebuttons-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adding Content to an iFrame and Print its Contents</title>
		<link>http://www.ramirezcobos.com/2010/10/04/adding-content-to-an-iframe-and-print-its-contents/</link>
		<comments>http://www.ramirezcobos.com/2010/10/04/adding-content-to-an-iframe-and-print-its-contents/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 06:39:44 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=257</guid>
		<description><![CDATA[I was working on a project and I had to create a print friendly version of a bill and even though it sounds so easy to do, I had to face some browser problems. For some reason, that I couldn&#8217;t find, there was no universal solution to it -or at least I couldn&#8217;t find one that worked with every  [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a project and I had to create a print friendly version of a bill and even though it sounds so easy to do, I had to face some browser problems. For some reason, that I couldn&#8217;t find, there was no universal solution to it -or at least I couldn&#8217;t find one that worked with every browser.</p>
<p>After breaking my head towards the wall and throwing some darts to Microsoft&#8217;s IE Browser poster I found one that worked.</p>
<pre class="brush: jscript; title: ; notranslate">
function iPrint( contentToPrint )
{
	// I have a hidden IFRAME within the document called
        // pfiframe (if you try to use jQuery here fails
	var oIframe = document.getElementById('pfiframe');
        // get a reference to the document
	var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
	if (oDoc.document) oDoc = oDoc.document;
        // now we write an entire HTML doc with the
        // contents we want to print in its body
	oDoc.write(&quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;title&lt;/title&gt;&quot;);
	oDoc.write(&quot;&lt;/head&gt;&lt;body&gt;&quot;);
       // check the function to print that we
       // include here
	oDoc.write( contentToPrint +
		&quot;&lt;script type='text/javascript'&gt;function printIt(){window.print();return false}&lt;/&quot; + &quot;script&gt;&lt;/body&gt;&lt;/html&gt;&quot;);
	oDoc.close();
       // again, I am not using jQuery here
       // for unknown reason, it fails to call
       // differently as it is here
	window.frames[0].printIt();
}
</pre>
<p>See? Easy right? Well I spent quite a lot of minutes to realize that! Hope this discovery help you guys out there.</p>
<p><center><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</center></p>
<a href="http://twitter.com/?status=RT%20%40%3A%20Adding%20Content%20to%20an%20iFrame%20and%20Print%20its%20Contents%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F10%2F04%2Fadding-content-to-an-iframe-and-print-its-contents%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/10/04/adding-content-to-an-iframe-and-print-its-contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PalmStudios Model Agency</title>
		<link>http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/</link>
		<comments>http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 14:03:03 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Portfolio]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=489</guid>
		<description><![CDATA[Hi there,
I would like to introduce you my last web project: http://www.palmstudios.com
For this project I have developed a sort of MVC (Model View Controller) over the RedBeanPHP DB library (PHP 5.3.2).  This project even though it looks quite simple it has a very power CMS (Content Management  [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-490" href="http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-00/"><img class="alignright size-medium wp-image-490" title="Captura de pantalla 2010-07-12 a las 16.03.00" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.00-300x248.png" alt="" width="300" height="248" /></a>Hi there,</p>
<p>I would like to introduce you my last web project: <a title="Palmstudios Model Agency" href="http://www.palmstudios.com" target="_blank">http://www.palmstudios.com</a></p>
<p>For this project I have developed a sort of MVC (Model View Controller) over the <a title="RedBean PHP" href="http://www.redbeanphp.com" target="_blank">RedBeanPHP</a> DB library (PHP 5.3.2).  This project even though it looks quite simple it has a very power CMS (Content Management System) on its backend that allows the model agency to control most of the aspects of its business:</p>
<ol>
<li>- Clients Management</li>
<li>- Models Management (Men, Women, Children &amp; Extras) -contact details, measurements, pictures, and so on&#8230;</li>
<li>- Promotional Packages Management &#8211; this is a special addon which allows the agency to create model promotional bundles to send to its clients</li>
</ol>
<p>There is a ton of client and server libraries that this application makes use of, such as:</p>
<ul>
<li>JQuery FancyBox</li>
<li>JQuery Livequery</li>
<li>JQuery AjaxQ</li>
<li>PHPMailer</li>
<li>RedBeanPHP</li>
<li>Savant3 Template Engine</li>
<li>PHPThumb</li>
<li>TinyMCE</li>
</ul>
<p>The CMS has a configuration section where site administrator can configure:</p>
<ul>
<li>Web site languages (has multiple language support)</li>
<li>Web site translations (you can even ask GOOGLE about a translation depending of the languages installed on the system)</li>
<li>Model properties (size, height, waist, etc&#8230;)</li>
<li>Hair Colors</li>
<li>Eye Colors</li>
<li>Users</li>
</ul>
<p>Here is a snapshot gallery of the Site and its CMS</p>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-00/' title='Captura de pantalla 2010-07-12 a las 16.03.00'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.00-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.03.00" title="Captura de pantalla 2010-07-12 a las 16.03.00" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-07-44/' title='Captura de pantalla 2010-07-12 a las 16.07.44'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.07.44-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.07.44" title="Captura de pantalla 2010-07-12 a las 16.07.44" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-08-21/' title='Captura de pantalla 2010-07-12 a las 16.08.21'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.08.21-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.08.21" title="Captura de pantalla 2010-07-12 a las 16.08.21" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-09-01/' title='Captura de pantalla 2010-07-12 a las 16.09.01'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.09.01-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.09.01" title="Captura de pantalla 2010-07-12 a las 16.09.01" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-09-27/' title='Captura de pantalla 2010-07-12 a las 16.09.27'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.09.27-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.09.27" title="Captura de pantalla 2010-07-12 a las 16.09.27" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-31/' title='Captura de pantalla 2010-07-12 a las 16.03.31'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.31-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.03.31" title="Captura de pantalla 2010-07-12 a las 16.03.31" /></a>
<a href='http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/captura-de-pantalla-2010-07-12-a-las-16-03-53/' title='Captura de pantalla 2010-07-12 a las 16.03.53'><img width="120" height="120" src="http://www.ramirezcobos.com/wp-content/uploads/2010/07/Captura-de-pantalla-2010-07-12-a-las-16.03.53-120x120.png" class="attachment-thumbnail" alt="Captura de pantalla 2010-07-12 a las 16.03.53" title="Captura de pantalla 2010-07-12 a las 16.03.53" /></a>
<h2>I am open for Freelance Jobs</h2>
<p>If any of you would like to create a model agency application like this, let me know, I will be more than happy to collaborate with you on it. I will also sell the source code of its panel for any of you who is interested.</p>
<p><center><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</center></p>
<a href="http://twitter.com/?status=RT%20%40%3A%20PalmStudios%20Model%20Agency%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F07%2F14%2Fpalmstudios-model-agency%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/07/14/palmstudios-model-agency/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Restaurant Casablanca</title>
		<link>http://www.ramirezcobos.com/2010/05/14/restaurant-casablanca/</link>
		<comments>http://www.ramirezcobos.com/2010/05/14/restaurant-casablanca/#comments</comments>
		<pubDate>Fri, 14 May 2010 10:12:57 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Portfolio]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=423</guid>
		<description><![CDATA[
Another site finished: www.brunocasablanca.com
Yeah, is a restaurant business, located in one of the most beautiful places in the Balearic Islands: Betlem, in La Colonia de San Pedro, Majorca, Spain. The site uses a web panel to control:
Picture Galleries
Web site  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-5.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Imagen-5-300x274.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/Imagen-5-300x274.png"></a><strong><span style="font-weight: normal;"> </span></strong></p>
<div id="attachment_410" class="wp-caption alignright" style="width: 310px"><a rel="attachment wp-att-410" href="http://www.ramirezcobos.com/2010/03/31/torrenova-rentacar/picture-1-5/"><a rel="attachment wp-att-425" href="http://www.ramirezcobos.com/2010/05/14/restaurant-casablanca/screen-shot-2010-05-14-at-11-59-50/"><img class="alignright size-medium wp-image-425" title="Screen shot 2010-05-14 at 11.59.50" src="http://www.ramirezcobos.com/wp-content/uploads/2010/05/Screen-shot-2010-05-14-at-11.59.50-300x214.png" alt="" width="300" height="214" /></a></a><p class="wp-caption-text">Bruno Casablanca Restaurant and Pizzeria</p></div>
<p><em>Another site finished: <a href="http://www.brunocasablanca.com" target="_blank">www.brunocasablanca.com</a></em></p>
<p>Yeah, is a restaurant business, located in one of the most beautiful places in the Balearic Islands: Betlem, in La Colonia de San Pedro, Majorca, Spain. The site uses a web panel to control:</p>
<ul>
<li>Picture Galleries</li>
<li>Web site content</li>
<li>Translations</li>
<li>Events</li>
<li>Suggestions</li>
</ul>
<p>In this site I make use of one of the greatest galleries around <a href="http://www.pirolab.it/pirobox/" target="_blank">Pirobox</a>, <a href="http://blog.philipbrown.id.au/2009/04/boxen-a-jquery-iframe-plugin/" target="_blank">boxen</a> -to display the menu, and <a href="http://page-flip.com/products/" target="_blank">FlippingBook HTML Edition</a> for the menu viewing. You can check the website and see how I implemented these three cool tools, feel free to ask me any doubt related to them in case you wish to use it in any of your sites.</p>
<a href="http://twitter.com/?status=RT%20%40%3A%20Restaurant%20Casablanca%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F05%2F14%2Frestaurant-casablanca%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/05/14/restaurant-casablanca/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Lightbox</title>
		<link>http://www.ramirezcobos.com/2010/02/08/visual-lightbox/</link>
		<comments>http://www.ramirezcobos.com/2010/02/08/visual-lightbox/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:38:19 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=273</guid>
		<description><![CDATA[This post is for those who wish to implement a beautiful Lightbox plugin on their site or blog and, unfortunately, do not have a clue about Javascript and/or jQuery and/or Html.
VisualLightBox is a free application that helps you easily generate online photo albums, lightbox gallery with a nice  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/lightboxXL-thumb.jpg"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/add-images-to-gallery.jpg"><img class="alignright size-medium wp-image-385" title="add-images-to-gallery" src="http://www.ramirezcobos.com/wp-content/uploads/2010/02/add-images-to-gallery-300x210.jpg" alt="" width="300" height="210" /></a></a>This post is for those who wish to implement a beautiful Lightbox plugin on their site or blog and, unfortunately, do not have a clue about Javascript and/or jQuery and/or Html.</p>
<p>VisualLightBox is a free application that helps you easily generate online photo albums, lightbox gallery with a nice Lightbox-style overlay effect, in a few clicks without writing a single line of code.</p>
<p>Just drag&amp;drop your photos to VisualLightBox wizard window, press &#8220;Publish&#8221; and your own css web site album with beautiful LightBox effects will open in the browser instantly!<br />
No css, image editing, javascript, html coding, just a click to get your cool web page album ready.</p>
<p>It takes less than a minute to have your own image gallery.</p>
<p>For full documentation please go to http://lightbox2.com/</p>
<p>Newbies, now there is no excuse to have your featured lightbox on your site!<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<a href="http://twitter.com/?status=RT%20%40%3A%20Visual%20Lightbox%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F02%2F08%2Fvisual-lightbox%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/02/08/visual-lightbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Latitude and Longitude with Google Maps V3</title>
		<link>http://www.ramirezcobos.com/2010/01/22/get-latitude-and-longitude-with-google-maps-v3/</link>
		<comments>http://www.ramirezcobos.com/2010/01/22/get-latitude-and-longitude-with-google-maps-v3/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:56:24 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Google Maps]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=251</guid>
		<description><![CDATA[I would like to share with you a little piece of code that I find quite useful in my applications. I do create lots of guides that require a small utility to find out the latitude and longitude of a business location from a control panel in order to display the maps appropiately on the Web. Here I  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-22.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-22-300x198.png"><img class="alignright size-full wp-image-320" title="Picture-22-300x198" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-22-300x198.png" alt="" width="300" height="198" /></a></a>I would like to share with you a little piece of code that I find quite useful in my applications. I do create lots of guides that require a small utility to find out the latitude and longitude of a business location from a control panel in order to display the maps appropiately on the Web. Here I will do my best to explain a step procedure on how to do that -once you know the procedure, it is easy to create plugins or whatever you wish to do.</p>
<h3>Step 1</h3>
<p>First of all, lets make a reference to the new version of Google Maps. Check that we have to specify a parameter sensor=false. To find out more about this parameter please follow this <a href="http://code.google.com/intl/en-EN/apis/maps/documentation/#SpecifyingSensor">link</a>.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
</pre>
<h3>Step 2</h3>
<p>Now we are going to write the HTML tags on the BODY of our document that will hold the map and the controls that will hold latitude, longitude and zoom level references. Also, see the CSS that control the size of the map holder.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;style&gt;
div#gmap {
width: 100%;
height: 300px;
}
&lt;/style&gt;
&lt;body&gt;
&lt;center&gt;
&lt;!-- MAP HOLDER --&gt;
&lt;div id="gmap"&gt;&lt;/div&gt;
&lt;!-- REFERENCES --&gt;
lat:&lt;span id="lat"&gt;&lt;/span&gt; lon:&lt;span id="lon"&gt;&lt;/span&gt;&lt;br/&gt;
zoom level: &lt;span id="zoom_level"&gt;&lt;/span&gt;
&lt;/center&gt;
&lt;/body&gt;
</pre>
<h3>Step 3</h3>
<p>Now, we are going to write the function that will display the map when the document loads. The function, that we will call &#8216;initialize&#8217; has different parts that we will describe now:</p>
<h4>Part 1</h4>
<p>Setting the map zoom level and its position in the world:</p>
<pre class="brush: jscript; title: ; notranslate">
var myLatlng = new google.maps.LatLng(38.971154274048345,1.415863037109375); // IBIZA <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
var myOptions = {
zoom: 16,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("gmap"), myOptions);
</pre>
<h4>Part 2</h4>
<p>Placing a marker on the map specifying its center position (please refer to above code for LatLon location).</p>
<pre class="brush: jscript; title: ; notranslate">
// marker refers to a global variable
marker = new google.maps.Marker({
position: myLatlng,
map: map
});
</pre>
<h4>Part 3</h4>
<p>Now, the events that will take control of the marker center re-positioning and placing the information on the correspondent document objects (lat, lon, and zoom level).</p>
<pre class="brush: jscript; title: ; notranslate">
// if center changed then update lat and lon document objects
google.maps.event.addListener(map, 'center_changed', function() {
var location = map.getCenter();
document.getElementById("lat").innerHTML = location.lat();
document.getElementById("lon").innerHTML = location.lng();
// call function to reposition marker location
placeMarker(location);
});
// if zoom changed, then update document object with new info
google.maps.event.addListener(map, 'zoom_changed', function() {
zoomLevel = map.getZoom();
document.getElementById("zoom_level").innerHTML = zoomLevel;
});
// double click on the marker changes zoom level
google.maps.event.addListener(marker, 'dblclick', function() {
zoomLevel = map.getZoom()+1;
if (zoomLevel == 20) {
zoomLevel = 10;
}
document.getElementById("zoom_level").innerHTML = zoomLevel;
map.setZoom(zoomLevel);
});
</pre>
<h4>Part 4</h4>
<p>Initialize the document objects with default information</p>
<pre class="brush: jscript; title: ; notranslate">
document.getElementById("zoom_level").innerHTML = 16;
document.getElementById("lat").innerHTML = 38.971154274048345;
document.getElementById("lon").innerHTML = 1.415863037109375;
</pre>
<h4>Step 4</h4>
<p>Finally, we have to write the function that will reposition the marker on &#8216;zoom_changed&#8217; map event and call the &#8216;initialize&#8217; function on window load event.</p>
<pre class="brush: jscript; title: ; notranslate">
function placeMarker(location) {
var clickedLocation = new google.maps.LatLng(location);
marker.setPosition(location);
}
window.onload = function(){initialize()};
</pre>
<p>And that&#8217;s it, we have a great utility to plug onto our projects in order to find out the latitude and longitude of an address.</p>
<h3>DOWNLOAD</h3>
<p>I have included the working version of this tutorial for you to download. If you make any changes on the code in order to improve/add more functionality to it (that is easy fellows), please share it here with us.</p>
<div style="padding: 10px; text-align: center; background-color: #ffffff; border: 3px solid #dddddd;"><table style="border: 1px solid #CCC;" cellpadding="3" width="100%">
  <tr>
    <td width="35">
      <img src="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif" alt="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif">
    </td>
    <td>
      <b>download:</b> <a href="http://www.ramirezcobos.com/?file_id=9">Get Lat Lon Finder</a> <small>(1.41KB)</small><br />
      <b>added:</b> 22/01/2010 <br />
      <b>clicks:</b> 2663 <br />
    </td>
  </tr>
</table></div>
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<a href="http://twitter.com/?status=RT%20%40%3A%20Get%20Latitude%20and%20Longitude%20with%20Google%20Maps%20V3%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F01%2F22%2Fget-latitude-and-longitude-with-google-maps-v3%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/22/get-latitude-and-longitude-with-google-maps-v3/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>jQuery 1.4 -Are you ready?</title>
		<link>http://www.ramirezcobos.com/2010/01/14/jquery-1-4-are-you-ready/</link>
		<comments>http://www.ramirezcobos.com/2010/01/14/jquery-1-4-are-you-ready/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 15:17:48 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[News]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=241</guid>
		<description><![CDATA[jQuery lovers, today, 14th of January, the programmers of jQuery celebrate its anniversary releasing a new version of this wonderful library. Better iFrame support, great new shorthands, I don&#8217;t know what to say fellows but I am eager to find out what its new features are capable of.
The jQuery  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2009/12/Picture-121.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-121-300x157.png"><img class="alignright size-full wp-image-372" title="Picture-121-300x157" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-121-300x157.png" alt="" width="300" height="157" /></a></a>jQuery lovers, today, 14th of January, the programmers of jQuery celebrate its anniversary releasing a new version of this wonderful library. Better iFrame support, great new shorthands, I don&#8217;t know what to say fellows but I am eager to find out what its new features are capable of.</p>
<p>The jQuery programmers not happy with a new release has also created a new  <a href="http://api.jquery.com/" target="_blank">jQuery API site</a>. Check what they have done on their API site <a href="http://jquery14.com/pre-release-1/new-jquery-api-site" target="_blank">here</a>.</p>
<p>John Resig will announce 1.4 release details tomorrow but meanwhile, you can download it and see for yourself.</p>
<ul>
<li><a rel="nofollow" href="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.js">Download jQuery 1.4 from Google CDN</a></li>
<li><a rel="nofollow" href="http://code.jquery.com/jquery-1.4.js">Download jQuery 1.4 from Official jQuery website</a></li>
</ul>
<p>Also, if you want to learn more about what is new in jQuery 1.4 then you might find the following resources useful:</p>
<ol>
<li><a rel="nofollow" href="http://jquery14.com/">14 Days of jQuery</a></li>
<li><a rel="nofollow" href="http://blog.jquery.com/">Official jQuery Blog</a></li>
<li><a rel="nofollow" href="http://futurecolors.ru/jquery/">jQuery 1.4 Cheatsheet</a></li>
<li><a rel="nofollow" href="http://twitter.com/jquery">jQuery on Tweeter</a></li>
</ol>
<p>Check what is new or changed on this new release <a href="http://api.jquery.com/category/version/1.4/" target="_blank">here</a>.</p>
<p>Happy birthday jQuery! Thanks for the good work!<br />
</p>
<a href="http://twitter.com/?status=RT%20%40%3A%20jQuery%201.4%20-Are%20you%20ready%3F%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F01%2F14%2Fjquery-1-4-are-you-ready%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/14/jquery-1-4-are-you-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build iPhone Web Apps with iWebKit</title>
		<link>http://www.ramirezcobos.com/2010/01/05/build-iphone-web-apps-with-iwebkit/</link>
		<comments>http://www.ramirezcobos.com/2010/01/05/build-iphone-web-apps-with-iwebkit/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 00:15:55 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=173</guid>
		<description><![CDATA[Iwebkit is the revolutionnairy open source development kit used to create high quality iPhone and iPod touch websites in a few minutes. In the first 4 months of it’s existance the pack has greatly evolved from a basic idea to a project that has reached worldwide fame!
This Open Source Free  [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-8.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/open-source-iphone-ipod-touch-development-kit-iwebkit-300x104.jpg"><img class="alignright size-full wp-image-296" title="open-source-iphone-ipod-touch-development-kit-iwebkit-300x104" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/open-source-iphone-ipod-touch-development-kit-iwebkit-300x104.jpg" alt="" width="300" height="104" /></a></a>Iwebkit is the revolutionnairy <strong>open source development kit</strong> used to create high quality <strong>iPhone and iPod touch websites</strong> in a few minutes. In the first 4 months of it’s existance the pack has greatly evolved from a basic idea to a project that has reached worldwide fame!</p>
<p style="text-align: justify;">This Open Source Free Development Kit is accessible to anyone even people without any html knowledge and is simple to understand. In a couple of minutes you will have created a full and profesional looking website.</p>
<p style="text-align: justify;">Awesome new and advanced features offered by no pack in the world like a custom popup and iphone-style form elements.</p>
<p style="text-align: justify;">Check out their website:<a href="http://iwebkit.net/"> http://iwebkit.net/</a></p>
<p style="text-align: justify;">And their demo: <a href="http://demo.iwebkit.net/">http://demo.iwebkit.net/</a></p>
<p style="text-align: center;"></p>
<a href="http://twitter.com/?status=RT%20%40%3A%20Build%20iPhone%20Web%20Apps%20with%20iWebKit%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F01%2F05%2Fbuild-iphone-web-apps-with-iwebkit%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/05/build-iphone-web-apps-with-iwebkit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cookie jQuery Plugin</title>
		<link>http://www.ramirezcobos.com/2010/01/02/cookie-jquery-plugin/</link>
		<comments>http://www.ramirezcobos.com/2010/01/02/cookie-jquery-plugin/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 12:18:29 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Plugin]]></category>
		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=148</guid>
		<description><![CDATA[As published on my last post, JSON gives us the great possibility to save objects on Cookies. I have already created a JSON Plugin for jQuery, then, why not create one Cookie Plugin that, in conjunction with the JSON plugin, allows us to save objects on cookies? Well, the challenge was simple and I  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2009/12/Picture-121.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-121-300x157.png"><img class="alignright size-full wp-image-372" title="Picture-121-300x157" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-121-300x157.png" alt="" width="300" height="157" /></a></a>As published <a href="http://www.ramirezcobos.com/2010/01/01/cookies-on-roids/">on my last post</a>, JSON gives us the great possibility to save objects on Cookies. I have already created a JSON Plugin for jQuery, then, why not create one Cookie Plugin that, in conjunction with the JSON plugin, allows us to save objects on cookies? Well, the challenge was simple and I decided to do it for those using jQuery.</p>
<h3>The code</h3>
<p>Remember than this plugin works in conjunction with my <a href="http://www.ramirezcobos.com/2009/12/30/json-jquery-plugin/">JSON jQuery Plugin</a>, also on this blog.</p>
<pre class="brush: jscript; title: ; notranslate">
jQuery.cookie = {
set : function(name,value,options){
options = $.extend({}, options);
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires &amp;&amp; (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
value = options.json ? encodeURIComponent($.JSON.encode(value)):encodeURIComponent(value);
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', value, expires, path, domain, secure].join('');
},
get : function(name,json){
var cookieValue = null;
if (document.cookie &amp;&amp; document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i &lt; cookies.length; i++) {
var cookie = $.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = json ? $.JSON.decode(decodeURIComponent(cookie.substring(name.length + 1))):decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
},
unset: function(name){
this.set(name,'',-1);
}
};
</pre>
<h3>How to use</h3>
<p>Note that you have to insert the jquery library on your head section and also the <a href="../2009/12/30/json-jquery-plugin/">JSON jQuery Plugin</a> -they are all included into the zip file below. Please, also refer to <a href="http://www.ramirezcobos.com/2010/01/01/cookies-on-roids/">the example provided on my last article &#8216;cookies on roids&#8217; </a>to view more cookie options.</p>
<pre class="brush: jscript; title: ; notranslate">
var obj = {json:'this is a test json property',xml:'this is a test xml property'};
var arr = ['A','B of 2 index array','C','D'];
var str = 'This is a string test';
var num = 123;
$.cookie.set('testobject',obj,{json:true});
$.cookie.set('testarray',arr,{json:true});
$.cookie.set('teststring',str);
$.cookie.set('testnumber',num);
var a = $.cookie.get('testobject',true);
var b = $.cookie.get('testarray',true);
var c = $.cookie.get('teststring');
var d = $.cookie.get('testnumber');
$.cookie.unset('testobject');
$.cookie.unset('testarray');
$.cookie.unset('teststring');
$.cookie.unset('testnumber');
alert('object:'+a.xml);
alert('array:'+b[1]);
alert('string:'+c);
alert('number:'+d);
</pre>
<p><strong>DOWNLOAD</strong><br />
The zip file includes the JSON jQuery Plugin and Cookie jQuery Plugin together with an example page on how to use them.</p>
<div style="padding: 10px; text-align: center; background-color: #ffffff; border: 3px solid #dddddd;"><table style="border: 1px solid #CCC;" cellpadding="3" width="100%">
  <tr>
    <td width="35">
      <img src="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif" alt="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif">
    </td>
    <td>
      <b>download:</b> <a href="http://www.ramirezcobos.com/?file_id=6">jQuery Cookie Plugin</a> <small>(23.84KB)</small><br />
      <b>added:</b> 02/01/2010 <br />
      <b>clicks:</b> 1695 <br />
    </td>
  </tr>
</table></div>
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<a href="http://twitter.com/?status=RT%20%40%3A%20Cookie%20jQuery%20Plugin%20-%20El%20Blog%20del%20Antonio%20http%3A%2F%2Fwww.ramirezcobos.com%2F2010%2F01%2F02%2Fcookie-jquery-plugin%2F" class="tweet-this" ><img src="http://www.ramirezcobos.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="Tweet this!" alt="Tweet this!" />Tweet this!</a>]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/02/cookie-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.ramirezcobos.com @ 2012-02-06 17:45:15 by W3 Total Cache -->
