<?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>Subesh Pokhrel&#039;s Blog - Magento Development Tips &#187; javascript</title>
	<atom:link href="http://subesh.com.np/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://subesh.com.np</link>
	<description>PHP &#38; Magento Tips and Tutorials</description>
	<lastBuildDate>Tue, 20 Mar 2012 18:15:10 +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>Working with Ajax and JSON Objects in Magento [Case: Ajax Powered Login Functionality]</title>
		<link>http://subesh.com.np/2010/08/working-ajax-json-objects-magento-case-ajax-powered-login-functionality/</link>
		<comments>http://subesh.com.np/2010/08/working-ajax-json-objects-magento-case-ajax-powered-login-functionality/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 08:46:08 +0000</pubDate>
		<dc:creator>Subesh Pokhrel</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Block]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://subesh.com.np/?p=278</guid>
		<description><![CDATA[Previously I have written about Working With Ajax in Magento. And after a huge response I received from that post I was compelled to write more on implementing Ajax in Magento. And this time I want to say additionally about handling JSON (JavaScript Object Notation) along with Ajax, within the Magento enviornment. JSON Objects and [...]]]></description>
			<content:encoded><![CDATA[<p>Previously I have written about <a href="http://subesh.com.np/2009/11/working-with-ajax-in-magento/">Working With Ajax in Magento</a>. And after a huge response I received from that post I was compelled to write more on implementing Ajax in Magento. And this time I want to say additionally about handling JSON (<strong>JavaScript Object Notation</strong>) along with Ajax, within the Magento enviornment. JSON Objects and Ajax can be very helpful technique to get the work done. You can learn about JSON from <a href="http://www.json.org/">Here</a>.</p>
<p>I will try to describe this issue by taking a case of changing the Magento&#8217;s login functionality to a Ajax powered login functionality. So after this you will be able to implement a login function in a pop-up div in any page, unlike the default Magento&#8217;s seperate login page. I will leave the pop-up div part to you and get started with the real business (AJAX and JSON).</p>
<p>Presuming that you will use <strong>Mini-Login</strong> form. Here is how you proceed.</p>
<ol>
<li>Change Submit type button to Button type button.</li>
<li>Register OnClick Javascript event of that button and its Handler</li>
<li>In the Handler function call Ajax Request for login</li>
<li>Show Error Message or redirect to customer Dashboard</li>
</ol>
<p>Your mini.login.phtml should be like this</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;&lt;?php //echo $this-&gt;getPostActionUrl() ?&gt;&quot; id=&quot;mini-login-form&quot; method=&quot;post&quot;&gt;
    &lt;fieldset&gt;
        &lt;p&gt;&lt;label&gt;&lt;?php echo $this-&gt;__('Email') ?&gt;:&lt;/label&gt; &lt;input name=&quot;login[username]&quot; class=&quot;input-text&quot; /&gt;&lt;/p&gt;
        &lt;p&gt;&lt;label&gt;&lt;?php echo $this-&gt;__('Password') ?&gt;:&lt;/label&gt; &lt;input name=&quot;login[password]&quot; class=&quot;input-text&quot; /&gt;&lt;/p&gt;
        &lt;p&gt;&lt;input type=&quot;button&quot; onClick=&quot;handlerFunction()&quot; value=&quot;&lt;?php echo $this-&gt;__('Login') ?&gt;&quot; /&gt;&lt;/p&gt;
    &lt;/fieldset&gt;
&lt;/form&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
function handlerFunction(){

// Write These codes only after form Validation

// Making Ajax Request
		var request = new Ajax.Request(
			//Defining Ajax Request URL, We are calling custom Controller Ns_Mylogin_AccountController Class (Defined Below)
        	'&lt;?php echo $this-&gt;getUrl(&quot;mylogin/account/loginPost&quot;) ?&gt;',
           	{
            	method: 'post',
                onComplete: function(transport){ // Defining Complete Callback Function

                	// Getting Ajax Response Text Which is JSON Object
                	var jsonResponse=transport.responseText;
                	//Checking JSON Objects property and performing related action
                	// You will understand the response Text format after going through the controller description (Below)
                	if(jsonResponse.error){
                		alert(&quot;Error Occured&quot;);
						return false;
                	}
                	else{
                		window.location.href=jsonResponse.url;
                	}
                },
                parameters: Form.serialize($(&quot;mini-login-form&quot;))	// Seriallizing the form input values
        	}
        );
}
//--&gt;
&lt;/script&gt;
</pre>
<p>Please see inline comments for better understanding. Now our next set should be setting up our custom controller. I&#8217;ll not get into details of setting up modules and all but directly to our controller class <strong>Ns_Mylogin_AccountController</strong>. What I&#8217;ve done is just taken the core&#8217;s  <strong>loginPostAction </strong>function of <strong>Mage_Customer_AccountController</strong> and added some codes there. Please see there is a comment on each line added apart from the default Magento&#8217;s core code.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once(&quot;Mage/Customer/controllers/AccountController.php&quot;);
class Ns_Mylogin_AccountController extends Mage_Customer_AccountController{
	/**
	 * Login post action
	 * @return JSON Object
	 */
	public function loginPostAction()
	{
		// Added Line #1
		$result[&quot;error&quot;]=0;

		$session = $this-&gt;_getSession();

		if ($this-&gt;getRequest()-&gt;isPost()) {
			$login = $this-&gt;getRequest()-&gt;getPost('login');
			if (!empty($login['username']) &amp;amp;&amp;amp; !empty($login['password'])) {
				try {
					$session-&gt;login($login['username'], $login['password']);
					if ($session-&gt;getCustomer()-&gt;getIsJustConfirmed()) {
						$this-&gt;_welcomeCustomer($session-&gt;getCustomer(), true);
					}
				} catch (Mage_Core_Exception $e) {
					switch ($e-&gt;getCode()) {
						case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
							//Added Line #2
							$result[&quot;error&quot;]=1;
							$message = Mage::helper('customer')-&gt;__('This account is not confirmed. &lt;a href=&quot;%s&quot;&gt;Click here&lt;/a&gt; to resend confirmation email.', 						Mage::helper('customer')-&gt;getEmailConfirmationUrl($login['username']));
							break;
						case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
							//Added Line #3
							$result[&quot;error&quot;]=1;
							$message = $e-&gt;getMessage();
							break;
						default:
							//Added Line #4
							$result[&quot;error&quot;]=1;
							$message = $e-&gt;getMessage();
					}
					$session-&gt;addError($message);
					$session-&gt;setUsername($login['username']);
				} catch (Exception $e) {
					// Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
				}
			} else {
				//Added Line #5
				$result[&quot;error&quot;]=1;
				$session-&gt;addError($this-&gt;__('Login and password are required'));
				//Added Line #6
				$this-&gt;getResponse()-&gt;setBody(Mage::helper('core')-&gt;jsonEncode($result));
			}
		}
		//Added Line #7
		$result[&quot;url&quot;]=$this-&gt;_loginPostRedirect();
		//Added Line #8
		$this-&gt;getResponse()-&gt;setBody(Mage::helper('core')-&gt;jsonEncode($result));
	}
</pre>
<p>What I&#8217;ve done is added an array <strong>$result</strong> that will hold value if there is error or not while processing the user&#8217;s request. If there is error that array will hold $result['error']=1 else it will be as initiallized in <em>Added Line #1</em>. From <em>Added Line #2</em> through <em>Added Line #5</em>, we have various condition to check for error and set our <strong>$result</strong> variable.</p>
<p>On <em>Added Line #7</em> we have called another function (which we we rewrite as well) that will give us the url location identifying which location should be redirect after successful login. The implementation of function is given below. Finally in <em>Added Line #8</em> and <em>Line #6</em> we have encoded our $result array into <strong>JSON</strong> format and send as the response.</p>
<p>For visuallization our $result array will be one of the following.</p>
<ol>
<li> Case (No Error) : $result["error"]=0; $result["url"]=&#8221;SOME Redirect URL&#8221;</li>
<li> Case (Error) 	 :	$result["error"]=1;</li>
</ol>
<p>This JSON encoded response will be then used by the ajax call back function defined and perform related action.</p>
<p>Here&#8217;s the <strong>_loginPostRedirect()</strong> function which I mentioned (Added Line #7).</p>
<pre class="brush: php; title: ; notranslate">
/**
	 * Define target URL and redirect customer after logging in
	 */
	protected function _loginPostRedirect()
	{
		$session = $this-&gt;_getSession();

		if (!$session-&gt;getBeforeAuthUrl() || $session-&gt;getBeforeAuthUrl() == Mage::getBaseUrl() ) {

			// Set default URL to redirect customer to
			$session-&gt;setBeforeAuthUrl(Mage::helper('customer')-&gt;getAccountUrl());

			// Redirect customer to the last page visited after logging in
			if ($session-&gt;isLoggedIn())
			{
				if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) {
					if ($referer = $this-&gt;getRequest()-&gt;getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME)) {
						$referer = Mage::helper('core')-&gt;urlDecode($referer);
						if ($this-&gt;_isUrlInternal($referer)) {
							$session-&gt;setBeforeAuthUrl($referer);
						}
					}
				}
				else if ($session-&gt;getAfterAuthUrl()) {
					$session-&gt;setBeforeAuthUrl($session-&gt;getAfterAuthUrl(true));
				}
			} else {
				$session-&gt;setBeforeAuthUrl(Mage::helper('customer')-&gt;getLoginUrl());
			}
		} else if ($session-&gt;getBeforeAuthUrl() == Mage::helper('customer')-&gt;getLogoutUrl()) {
			$session-&gt;setBeforeAuthUrl(Mage::helper('customer')-&gt;getDashboardUrl());
		}
		else {
			if (!$session-&gt;getAfterAuthUrl()) {
				$session-&gt;setAfterAuthUrl($session-&gt;getBeforeAuthUrl());
			}
			if ($session-&gt;isLoggedIn()) {
				$session-&gt;setBeforeAuthUrl($session-&gt;getAfterAuthUrl(true));
			}
		}
		// Changed Here
		return $session-&gt;getBeforeAuthUrl(true);
	}
</pre>
<p>You can download the code From <a href="http://code.google.com/p/subeshexamples/downloads/detail?name=Ajax_Json_Magento_subesh.com.np.zip#makechanges">Here</a>.</p>
<p>Hope it helps! Happy Coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://subesh.com.np/2010/08/working-ajax-json-objects-magento-case-ajax-powered-login-functionality/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Magento: Creating Ajax Updated Tabs In Frontend, Like Product Management Tabs of Backend</title>
		<link>http://subesh.com.np/2010/06/magento-creating-ajax-updated-tabs-frontend-product-management-tabs-backend/</link>
		<comments>http://subesh.com.np/2010/06/magento-creating-ajax-updated-tabs-frontend-product-management-tabs-backend/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 13:00:42 +0000</pubDate>
		<dc:creator>Subesh Pokhrel</dc:creator>
				<category><![CDATA[Custom Module]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://subesh.com.np/?p=254</guid>
		<description><![CDATA[Magento&#8217;s Product Management GUI in back-end has Tabbed Navigation. There are two types of Tabs implemented there. One type of Tab is normal tab, loading content on page load while other type of tab has its content loaded by &#8220;Ajax&#8221;. Another interesting thing to note is that once the Ajax loaded tab&#8217;s content is loaded [...]]]></description>
			<content:encoded><![CDATA[<p>Magento&#8217;s Product Management GUI in back-end has Tabbed Navigation. There are two types of Tabs implemented there. One type of Tab is normal tab, loading content on page load while other type of tab has its content loaded by &#8220;Ajax&#8221;. Another interesting thing to note is that once the Ajax loaded tab&#8217;s content is loaded it will not &#8220;recall&#8221; Ajax to load its content, rather earlier loaded tab content is show. If are &#8220;confused&#8221; then just see how the &#8220;Categories&#8221; tab of the Product Management works.</p>
<p>I successfully used the same &#8220;behavior&#8221; of tabbed navigation in &#8220;front-end&#8221;, was easy at the end (always with Magento, when you get it), but I was struggling at the start. So, like my other posts, to share here&#8217;s how I used the same type of tab in Magento&#8217;s Front-end.</p>
<p>First thing is add the Tab&#8217;s Java-script file. You can either include by layout or in PHTML file. If you want to do from layout then,</p>
<pre class="brush: xml; title: ; notranslate">
&lt;reference name=&quot;head&quot;&gt;
        	 &lt;action method=&quot;addJs&quot;&gt;&lt;script&gt;mage/adminhtml/tabs.js&lt;/script&gt;&lt;/action&gt;
&lt;/reference&gt;
</pre>
<p>Next thing is to create Tab&#8217;s Menu inside UL &#038; LI. Here&#8217;s the structure. (Self Explanatory)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- TAB MENU STRUCTURE --&gt;

&lt;ul id=&quot;page_tabs&quot;&gt;
	&lt;!-- NORMAL TAB --&gt;
	&lt;li&gt;
		&lt;a id=&quot;normaltab&quot; name=&quot;normaltab&quot; class=&quot;tab-item-link&quot; href=&quot;#&quot;&gt; NORMAL TAB &lt;/a&gt;
		&lt;!-- NOTE: class has to be tab-item-link--&gt;

		&lt;div id=&quot;normaltab_content&quot;&gt; Normal Tab HTML&lt;/div&gt;
		&lt;!-- NOTE: See the id of this div content it has id equal to its anchor's (&lt;a&gt;) id + Underscore + content --&gt;
	&lt;/li&gt;
	&lt;!-- NORMAL TAB END--&gt;

	&lt;!-- AJAX LOADED TAB --&gt;
	&lt;li&gt;
		&lt;a id=&quot;ajaxtab&quot; name=&quot;ajaxtab&quot; class=&quot;tab-item-link ajax notloaded&quot; href=&quot;http://example.com/magento/module/controller/action&quot;&gt; AJAX TAB &lt;/a&gt;
		&lt;!-- NOTE 1: class has to be tab-item-link ajax notloaded --&gt;
		&lt;!-- NOTE 2: Since this is Ajax Loaded Tab its Anchor should have href value = SOME URL --&gt;

		&lt;div id=&quot;ajaxtab_content&quot;&gt;&lt;/div&gt;
		&lt;!-- NOTE 1: See the id of this div content it has id equal to its anchor's (&lt;a&gt;) id + Underscore + content --&gt;
		&lt;!-- NOTE 2: Since its innerHTML will be loaded by by Ajax you can set its innerHTML &quot;blank&quot; --&gt;

	&lt;/li&gt;
	&lt;!-- AJAX LOADED TAB END --&gt;
&lt;/ul&gt;
&lt;!-- TAB MENU STRUCTURE END --&gt;

&lt;!-- TAB CONTENT CONTAINER DIV--&gt;
&lt;div id=&quot;tabcontainer&quot;&gt;&lt;/div&gt;
&lt;!-- TAB CONTENT CONTAINER DIV--&gt;
</pre>
<p>Now its the time to use the Tabs JS included, like below.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script&gt;
	// Form Key Required for POST AJAX Method
	var FORM_KEY=&quot;&lt;?php echo Mage::getSingleton('core/session')-&gt;getFormKey() ?&gt;&quot;;

	// Set this to false, Guess used for some other purpose in backend, not really required in frontend.
	var varienGlobalEvents=false;

	// Initiallizing Varien Tabs
	/**
	* @param 1 : UL Menu ID
	* @param 2 : Target Tab Content ID
	* @param 3 : Initially Loading Tab's Id
	* @param 4 : Don't know yet, just use as it is (LOL)
	*/

	frontend_tabsJsTabs = new varienTabs('page_tabs', 'tabcontainer', 'normaltab',[]);

&lt;/script&gt;
</pre>
<p>Done! You must now have a functioning Tab loading by Ajax and Normal, but yes tab would look good if you add CSS to your Tabs. <img src='http://subesh.com.np/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  Here is how it works.</p>
<ol>
<li>
On load it first copies the tab_content div inside the Target Tab Content ID div.
</li>
<li>
On tabbed menu clicked it checks its class name and if it class name does not have &#8220;ajax&#8221; it simply shows the its_content div.
</li>
<li>
If the menu clicked has &#8220;ajax&#8221; then it checks for another class name &#8220;notloaded&#8221;. So if its ajax and notloaded it then makes an Ajax request and updates the responseText to itsid_content div and then removes the &#8220;notloaded&#8221; class name for the menu. After that it then displays the itsid_content div, hiding previous ones.
</li>
<li>
If you re-click the &#8220;Ajax&#8221; typed menu, it will not find &#8220;notloaded&#8221; class in its menu, then it just shows its_content div.
</li>
</ol>
<p>A good trick, I thought while doing this, using class name to restrict the Ajax call.</p>
]]></content:encoded>
			<wfw:commentRss>http://subesh.com.np/2010/06/magento-creating-ajax-updated-tabs-frontend-product-management-tabs-backend/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get Latitude and Longitude Of User From Simple Javascript!</title>
		<link>http://subesh.com.np/2009/07/get-latitude-and-longitude-of-user-from-simple-javascript/</link>
		<comments>http://subesh.com.np/2009/07/get-latitude-and-longitude-of-user-from-simple-javascript/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 04:04:01 +0000</pubDate>
		<dc:creator>Subesh Pokhrel</dc:creator>
				<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>

		<guid isPermaLink="false">http://subesh.com.np/?p=77</guid>
		<description><![CDATA[I am a big fan of Latitude and Longitude, as you all might know, I have other post related to Latitude and Longitude and Google Maps. I came across one of the greatest feature of Mozilla Firefox 3.5, and that was to get the latitude and Longitude of user using simple Javascript. No API to [...]]]></description>
			<content:encoded><![CDATA[<p>I am a big fan of Latitude and Longitude, as you all might know, I have other post related to Latitude and Longitude and Google Maps.<br />
I came across one of the greatest feature of Mozilla Firefox 3.5, and that was to get the latitude and Longitude of user using simple Javascript. No API to use, No query to Google or anything. Here&#8217;s the code.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script&gt;
if (navigator.geolocation) {
 var watchID = navigator.geolocation.watchPosition(function(position) {
  do_something(position.coords.latitude, position.coords.longitude);
}
);
} else {
  alert(&quot;I'm sorry, but geolocation services are not supported by your browser.&quot;);
}

function do_something(lat,long){
alert(lat);
alert(long);
}
&lt;/script&gt;
</pre>
<p>Remember this only works on Mozilla Firefox 3.5. I&#8217;ll later come up with using this method to plot user on Google Maps, So follow on !</p>
]]></content:encoded>
			<wfw:commentRss>http://subesh.com.np/2009/07/get-latitude-and-longitude-of-user-from-simple-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tabbed Infowindow in Google Maps</title>
		<link>http://subesh.com.np/2008/07/tabbed-infowindow-in-google-maps/</link>
		<comments>http://subesh.com.np/2008/07/tabbed-infowindow-in-google-maps/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 12:27:00 +0000</pubDate>
		<dc:creator>Subesh Pokhrel</dc:creator>
				<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>

		<guid isPermaLink="false">http://subesh.com.np/?p=64</guid>
		<description><![CDATA[I wanted to show different categories of information on one GMarker. That is I wanted to show different types of information on a Infowindow for a point on Google Maps. For that I used a tabbed info window, which helped me to show different data on each tabs. Here is the code of what I [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to show different categories of information on one GMarker. That is I wanted to show different types of information on a Infowindow for a point on Google Maps. For that I used a tabbed info window, which helped me to show different data on each tabs. Here is the code of what I have done. I have shown the latitude and longitude of a placed clicked on the map on the tabbed info window. This is just the script part. The demo and download links are given below.</p>
<pre class="brush: jscript; title: ; notranslate">
 &lt;script type=&quot;text/javascript&quot;&gt;
     var iconBlue = new GIcon();
    iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);
    var point = new GLatLng(26.88157422515243, 86.30859375);
    function load() {
		  if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById(&quot;map&quot;));
			map.setCenter(point,3);
			GEvent.addListener(map, 'click', function(overlay, point) {
			  var lati=point.lat();
			  var long=point.lng();
			  var marker= new GMarker(new GLatLng(lati, long),{draggable: false});
			  map.addOverlay(marker);
				  var infoTabs = [	new GInfoWindowTab(&quot;Lat-Tab&quot;, &quot;&lt;h1&gt; Latitude:&lt;/h1&gt;&lt;br /&gt;&quot;+lati),	new GInfoWindowTab(&quot;Long-Tab&quot;, &quot;&lt;h1&gt;Longitude&lt;/h1&gt;&lt;br /&gt;&quot;+long)];
			  marker.openInfoWindowTabsHtml(infoTabs);
			 });
		}
	}
  &lt;/script&gt;
</pre>
<p>Lets focus on the <strong>#17-#26</strong> Lines of codes. Other Lines are already described on other posts. Please see the related post link below the post.<br />
<strong>#17:</strong> Creates a GMarker on the point where clicked on the Map.<br />
<strong>#18:</strong> Addes the GMarker over the Map.<br />
<strong>#19:</strong> Initiates an array of tabs<strong>infoTabs </strong> with <strong>GInfoWindowTab </strong> function with <strong>tabname</strong> and its <strong>innerHTML</strong> as parameters.<br />
<strong>#20:</strong> Opens the infowindow calling <strong>openInfoWindowTabsHtml</strong> function and the array of tabs as parameters.</p>
<p><a href="http://subeshexamples.googlecode.com/files/tabinfo.html"><strong>[Download]</strong></a> <a href="http://subesh.com.np/demo/tabinfo.html"><strong>[Demo]</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://subesh.com.np/2008/07/tabbed-infowindow-in-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring TinyMCE:Simple Setup</title>
		<link>http://subesh.com.np/2008/06/configuring-tinymcesimple-setup/</link>
		<comments>http://subesh.com.np/2008/06/configuring-tinymcesimple-setup/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 09:21:45 +0000</pubDate>
		<dc:creator>Subesh Pokhrel</dc:creator>
				<category><![CDATA[TinyMCE]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://subesh.com.np/?p=31</guid>
		<description><![CDATA[Everybody is already familiar with WYSIWYG editor. Before, doing CMS projects I used to use fckeditor, and I always had a problem with its bad design and loading time. Though you can config the editor to just the actions you need. I still felt something was not right about it. And I searched about editors, [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody is already familiar with WYSIWYG editor. Before, doing CMS projects I used to use fckeditor, and I always had a problem with its bad design and loading time. Though you can config the editor to just the actions you need. I still felt something was not right about it. And I searched about editors, then I came across TinyMCE editor.</p>
<p>TinyMCE is platform independent, javascript based editor and has a very special feature of changing the textareas into the editor&#8217;s instance. It takes lesser time then fckeditor or other editors I have used. It also has a simple look and can fit into any designs. And its pretty easy to configure too. You can download it from <a href="http://tinymce.moxiecode.com/download.php">http://tinymce.moxiecode.com/download.php</a>. Here is code that may help you through configuring it for minimal use.</p>
<pre class="brush: jscript; title: ; notranslate">

&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot; src=&quot;../tinymce/tiny_mce.js&quot;&gt;&lt;/script&gt;

&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
tinyMCE.init({
	theme : &quot;advanced&quot;,
	mode: &quot;exact&quot;,
	elements : &quot;content&quot;,
	theme_advanced_toolbar_location : &quot;top&quot;,
	theme_advanced_buttons1 : &quot;bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,separator,undo,redo&quot;,
	theme_advanced_buttons2 : &quot;&quot;,
	theme_advanced_buttons3 : &quot;&quot;,
	height:&quot;350px&quot;,
	width:&quot;600px&quot;
});
&lt;/script&gt;
</pre>
<p><strong>Code #1 :</strong> Includes the tinymce files for the page.<br />
<strong>Code #4-#14:</strong> Initiates the tinymce instance for the page.<br />
<strong>Code#5-#6:</strong> TinyMCE has a lots of themes and mode which you can configure to exactly what you want. Let&#8217;s leave this for now. Just keep those two.<br />
<strong>Code#7:</strong> Now here&#8217;s the tricky part. You should keep here the name/Id of the textarea on which tinyMCE is decorated. If you want many editor&#8217;s instance on the same page, just add other textarea element seperated with commas.<br />
<strong>Code#8:</strong> Defines where the toolbar is placed. The other option is bottom.<br />
<strong>Code#9: </strong>Defines the tools avaliable. You can put custom tools wherever you like, either on button1 or button2 or button3.<br />
<strong>Code #12-#13:</strong> Defines the height and width of the editor.</p>
<p>This is just a simple set up for tinyMCE, I am looking forward to adding more on this. Catch me later.</p>
]]></content:encoded>
			<wfw:commentRss>http://subesh.com.np/2008/06/configuring-tinymcesimple-setup/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

