<?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>Nazly [Web Log] &#187; Web</title>
	<atom:link href="http://www.nazly.net/category/technology/web-technology-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nazly.net</link>
	<description>Personal Weblog of Nazly Ahmed : Web Developer. PHP Addict. Wordpress Hacker. FOSS Enthusiast. (Micro)Blogger. Cricket Fanatic. Husband. Dad.</description>
	<lastBuildDate>Mon, 24 Oct 2011 08:06:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jQuery noConflict() saves the day!</title>
		<link>http://www.nazly.net/jquery-noconflict-saves-the-day/</link>
		<comments>http://www.nazly.net/jquery-noconflict-saves-the-day/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 07:04:15 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[conflict]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.nazly.net/?p=1316</guid>
		<description><![CDATA[All these years I have been only using jQuery as a Java Script framework. But I came across this situation where I had to use both jQuery and Prototype in one of my projects. This unavoidable situation resulted in jQuery (&#8230;)<p><a href="http://www.nazly.net/jquery-noconflict-saves-the-day/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nazly.net/wp-content/uploads/2011/02/jquery.jpg"><img src="http://www.nazly.net/wp-content/uploads/2011/02/jquery.jpg" alt="" title="jquery" width="250" height="82" class="alignleft size-full wp-image-1324" /></a> All these years I have been only using <a href="http://jquery.com/" target="_blank">jQuery</a> as a Java Script framework. But I came across this situation where I had to use both <a href="http://jquery.com/" target="_blank">jQuery</a> and <a hrea href="http://www.prototypejs.org/" target="_blank">Prototype</a> in one of my projects.  This unavoidable situation resulted in jQuery functions not working as its supposed to. The obvious reason was a conflict between the two libraries. A Google search revealed that this is a common problem and the good news was jQuery already had a solution for it.</p>
<p><span id="more-1316"></span><span style="color: #666666;"><em>&#8220;Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery&#8217;s case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict():&#8221;</em></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;other_lib.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  $.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Code that uses jQuery's $ can follow here.</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// Code that uses other library's $ can follow here.</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>It&#8217;s simple as that. It&#8217;s simply why the rest of the world and I love jQuery..!!<br />
More info can be found <a href="http://api.jquery.com/jQuery.noConflict/" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/jquery-noconflict-saves-the-day/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sad state of online advertising in Sri Lanka</title>
		<link>http://www.nazly.net/sad-state-of-online-advertising-in-sri-lanka/</link>
		<comments>http://www.nazly.net/sad-state-of-online-advertising-in-sri-lanka/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 11:14:17 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[advertisement]]></category>
		<category><![CDATA[classifieds]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[sale]]></category>
		<category><![CDATA[srilanka]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.nazly.net/?p=1299</guid>
		<description><![CDATA[There are tons of Online Advertising Websites all over the Internet that are targeted to the Sri Lankan market. Since developing dynamic Websites became quite popular, classified Websites emerged as a great tool that bridged the gap between buyers and (&#8230;)<p><a href="http://www.nazly.net/sad-state-of-online-advertising-in-sri-lanka/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nazly.net/wp-content/uploads/2010/12/1.jpg" alt="" title="Classifieds" width="250" height="188" class="alignleft size-full wp-image-1311" /> There are tons of Online Advertising Websites all over the Internet that are targeted to the Sri Lankan market. Since developing dynamic Websites became quite popular, classified Websites emerged as a great tool that bridged the gap between buyers and sellers. Most of the Websites offer their services free of charge or at a reasonable fee. The sellers can manage their advertisements on these Websites. It&#8217;s a basic requirement for any Classified Website so that it will display the most recent and appropriate advertisements. There are few Websites that serves the purpose and have been providing a quality service.</p>
<p><span id="more-1299"></span>This blog post is not about the real ones, but the clones who try to ride the luck of their successors. Anyone with a basic Web Development knowledge can setup such Websites. A lot of companies and individuals saw this as an opportunity to make money online and started to set up more and more of those. The main objective of course is to generate content that would increase their revenue through click/impression ads and various other forms of advertisements.</p>
<p>These Websites wanted to make themselves look real. So they took the easy way out. They started grabbing advertisement posted by sellers on most popular Websites. They even grabbed ads from print media to generate content on their Website.</p>
<p>Sellers were affected by these clones. Specially if you are someone who occasionally sell your used goodies. You are supposed to remove your ad once the item has been sold. But when you still get inquiries for the items you have already sold, you tend to realize your advertisement appearing on Websites that you didn&#8217;t even think of advertising. </p>
<p>I&#8217;m quite used to sell my used electronic goodies using a popular Website and removed the ad once the item was sold. To my annoyance I still get calls asking for my laptop I sold almost 2 years back. The list goes on for my camera, monitor etc.. In January this year I put an ad to sell my car and then decided not to. Despite the ad being removed for almost a year, I still get calls and the recent one being last week. While I can google and find where my ad exist but I cannot remove them coz I didn&#8217;t put them there in the first place.</p>
<p>Actually its quite a sad situation. Whether to give out our mobile number is a tough call we need to make when advertising our goodies for sale. It&#8217;s likely that most of them won&#8217;t contact us via Email if they only find an Email address as a contact point. What are your thoughts and experience in the matter?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/sad-state-of-online-advertising-in-sri-lanka/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Basics of maintaing a WordPress site</title>
		<link>http://www.nazly.net/basics-of-maintaing-a-wordpress-site/</link>
		<comments>http://www.nazly.net/basics-of-maintaing-a-wordpress-site/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 17:36:45 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[notificaion]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[uptime]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.nazly.net/?p=903</guid>
		<description><![CDATA[WordPress is simple, yet powerful. Those are the key ingredients why it is popular among the Bloggers and Web Developers alike. WordPress will always be the first choice as a blogging platform. In the recent times it has moved far (&#8230;)<p><a href="http://www.nazly.net/basics-of-maintaing-a-wordpress-site/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1072" title="wordpress-logo" src="http://www.nazly.net/wp-content/uploads/2011/06/wordpress-logo.png" alt="" width="250" height="155" /> <a href="http://wordpress.org">WordPress</a> is <strong>simple</strong>, yet <strong>powerful</strong>. Those are the key ingredients why it is popular among the Bloggers and Web Developers alike. WordPress will always be the first choice as a blogging platform. In the recent times it has moved far from being just a blogging engine. Most Web developers choose WordPress as their primary <a href="http://en.wikipedia.org/wiki/Content_management_system">CMS</a> of choice ahead of other popular Content Management Systems. Regardless of you being a Blogger or a Web Developer, the manner you maintain your WordPress files and database will play an important role in running a successful website.</p>
<p><span id="more-903"></span>Maintaining and monitoring your WordPress site requires performing certain tasks on a regular basis. The term regular will depend on how often your Website gets updated. Depending on the frequency you will need to plan this out. If you run a Website that gets updated daily (eg: news), then taking daily backups is a high priority. Performing these tasks manually can become a tedious process. There are plenty of tools and techniques available to automate them.</p>
<h3>Monitoring a Website</h3>
<p>You might want to use a <a href="http://www.google.lk/search?q=Website+Monitoring+Service">Website Monitoring Service</a> to check whether your website is up and running. There are plenty of services over the Internet if you Google for it. These services offer monitoring your Web Server (HTTP), FTP, Mail Server (POP &amp; SMTP), SSL, DNS and custom TCP ports on regular intervals. If any of these don&#8217;t respond, the service will alert you via Email or SMS. Most of them offer limited options for free while you need to pay based on the additional services you require. This type of monitoring is not WordPress specific and can apply to any Wesbite.</p>
<p>If you are a developer you can code your own monitoring system which will be cost efficient and can be expandable according to your monitoring requirements. Using <a href="http://php.net/manual/en/function.fsockopen.php">socket functions</a> and tools like <a href="http://www.php.net/manual/en/ref.curl.php">curl</a> can assist in doing that. </p>
<p>In any of the case above, you will need to specify the port of the service you wish to monitor. In certain cases, the port can occasionally differ from the default port that particular service would run depending on how it is configured on your Server. So you need to specify the correct one. </p>
<p>There is one instance that most of the Bloggers/Web Developers fail to address. While your Web Server/Apache might run smoothly, there is a possibility that your database might not respond. This can happen when your DB gets corrupted, privileges get messed up or your MySQL Server crashes for some reason. In this case WordPress will send you this ugly message on a plain white page. </p>
<p><img src="http://www.nazly.net/wp-content/uploads/2011/06/databaseerror.jpg" alt="" title="databaseerror" width="394" height="37" class="alignnone size-full wp-image-1097" /></p>
<p>It&#8217;s not suitable to show an error message of this nature to your visitors. Most importantly the HTTP status code for this response is 200, which means Search Engines will pick it up as your content for the site. If this message hangs on for long, you will get indexed on Google with this Error Message.</p>
<p>Here is how you can display a custom error message with your design template and get notified at the same time when your DB doesn&#8217;t respond.</p>
<p>Create a file called <strong>db-error.php</strong> and store that file under the wp-contents folder.<br />
The contents of the file should be..</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HTTP/1.0 500 Internal Server Error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;webmaster@mydomain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;DB fail&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Down at : &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d H:i:s&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;html&gt;Your customer error message with yout HTML template&lt;/html&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It&#8217;s that simple..!</p>
<p>WordPress will execute the above script when the DB doesn&#8217;t respond. The first line will send the HTTP response code 500 (Internal Server Error) so that Search Engines won&#8217;t index it. The next line will send an email to you, notifying the time the DB went down. Third line will output the HTML of your template where you can include a custom error message. You can extend this piece of code to fit into your needs. Instead of Email, you could use SMS/Twitter to get instantly notified. </p>
<h3>Backup</h3>
<p>Taking regular backups of your WordPress installation and most importantly the database regularly will help to restore your Website within minutes if any data loss occurs. A hard disk crash, server failure or even a hacker wiping out all your data can be some of the reasons how a data loss could occur. While your hosting provider might do the backup for you, its always good to have your own. If you take regular backups, you are never a loser.</p>
<p>One of the important folders to backup is the wp-contents folder, but I would advise you to backup the whole WordPress installation directory. You will also need to backup the MySQL database. A simple MySQL dump would do. If you are the average blogger, then there are quite a lot of <a href="http://wordpress.org/extend/plugins/search.php?q=backup">WordPress plugins for backup</a> which would do the job for you. If you have shell access, I would advice you to write a shell script that would backup the files and database. Add a cron job to execute the script based on how frequent you wish to take backups. If you don&#8217;t have shell access, you can try using the options in your Web Hosting Control Panel. </p>
<h3>Security</h3>
<p>When it comes to security, applying the correct patches and upgrading to the newest version of the core and plugins of WordPress will prevent the hackers  from trying to exploit the vulnerabilities in your Website. While this can be automated, it is advisable you do this process manually to reduce complications that may arise after an upgrade. It will depend on the plugins you use and the purpose you use it for. Golden rule before upgrade is to backup your WordPress files and DB so that you can restore it if something goes wrong.</p>
<p>Before choosing the right plugin to use, make sure to check the compatibility of the plugin with the version of WordPress you are running. Also make sure to check the ratings of the plugin. All these information is available on the plugin&#8217;s page.</p>
<p>Good luck..!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/basics-of-maintaing-a-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>lkgeeks.org back with new looks &amp; ideas</title>
		<link>http://www.nazly.net/lkgeeks-org-back-with-new-looks-ideas/</link>
		<comments>http://www.nazly.net/lkgeeks-org-back-with-new-looks-ideas/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 08:35:53 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[lkgeeks]]></category>
		<category><![CDATA[lkgeeks.org]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[srilanka]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://www.nazly.net/?p=816</guid>
		<description><![CDATA[When I planned to revamp lkgeeks.org some where around the end of last year, I wanted to make it happen within a month. But things got bit dragged and new ideas came in and now I have almost taken it (&#8230;)<p><a href="http://www.nazly.net/lkgeeks-org-back-with-new-looks-ideas/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-826" title="logo" src="http://www.nazly.net/wp-content/uploads/2010/03/logo.jpg" alt="logo" width="241" height="80" /></p>
<p>When I planned to <a href="/revamping-lkgeeks-org/" target="_blank">revamp lkgeeks.org</a> some where around the end of last year, I wanted to make it happen within a month. But things got bit dragged and new ideas came in and now I have almost taken it to the next level. The website has been re-launched. You can check the site out at <a href="http://www.lkgeeks.org" target="_blank">www.lkgeeks.org</a>. There is a dedicated <a href="http://twitter.com/lkgeeks" target="_blank">Twitter account</a> and a <a href="http://www.facebook.com/pages/lkgeeksorg/326106503036" target="_blank">Facebook fan page</a> to connect all the Sri Lankan geeks. A new <a href="http://twitter.com/lkgeeks/twitters" target="_blank">Twitter List</a> has been created, so the Twitter Feed on lkgeeks.org will be based on this list.</p>
<p><span id="more-816"></span></p>
<p>While the initial idea of aggregating the blog posts and tweets of Sri Lankan geeks still remains, lkgeeks.org will provide more interaction among the geeks in Sri Lanka. From being connecting everyone virtually, it has gone a step further up by trying to get all of them physically together to share knowledge and experience. While this is a challenging task, lkgeeks.org has taken up this challenge to arrange workshops/meetups which will be free or at an affordable price (to cover the cost).  The workshops will be conducted by our own local experts in their relevant field. The topics will be based on the latest emerging technologies which will be a great way for the Sri Lankan geeks to start adopting to it. Topics/date/time/venue will be announced soon.</p>
<p>So keep checking the <a href="http://www.lkgeeks.org" target="_blank">website</a>, follow lkgeeks.org on <a href="http://twitter.com/lkgeeks" target="_blank">Twitter</a> and become a fan on <a href="http://www.facebook.com/pages/lkgeeksorg/326106503036" target="_blank">Facebook</a> to be first informed. Let me know your thoughts and comments as it will help in a great deal to improve on what I have built so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/lkgeeks-org-back-with-new-looks-ideas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHPMailer for the rescue</title>
		<link>http://www.nazly.net/phpmailer-for-the-rescue/</link>
		<comments>http://www.nazly.net/phpmailer-for-the-rescue/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 09:15:47 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[inline]]></category>
		<category><![CDATA[phpmailer]]></category>

		<guid isPermaLink="false">http://www.nazly.net/?p=729</guid>
		<description><![CDATA[When we start building a dynamic website or a Web Application using PHP, sending out Emails to the users is always on top of the To-Dos list. In most cases it will require sending the email in a specific template (&#8230;)<p><a href="http://www.nazly.net/phpmailer-for-the-rescue/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>When we start building a dynamic website or a Web Application using PHP, sending out Emails to the users is always on top of the To-Dos list. In most cases it will require sending the email in a specific template to maintain the branding of the website/application. In this situation the developer has to send out the emails in HTML Format.</p>
<p><span id="more-729"></span></p>
<p>When you use PHP&#8217;s built-in mail() function with the basic parameters, the email is sent out in plain-text.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user@mydomain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;This is the Subject&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Hello World&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>To send out HTML Emails using the built-in mail() function, you will require to add another parameter where you can specify the headers of the email. Here I will add some additional headers to send out a proper a Email with a from address as well. The additional headers should be separated with a <a href="http://en.wikipedia.org/wiki/Newline" target="_blank">CRLF (\r\n)</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">#Specify a From Address
</span><span style="color: #000088;">$addHeaders</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;From: webmaster@ourwebsite.com&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Set the content-type to send out the email in HTML format
</span><span style="color: #000088;">$addHeaders</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;MIME-Version: 1.0&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$addHeaders</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-type:text/html;charset=iso-8859-1&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Mail Body consists HTML tags
</span><span style="color: #000088;">$mailBody</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;h1&gt;Hello World&lt;/h1&gt;
                 &lt;strong&gt;Example: &lt;/strong&gt;How to send a HTML Email&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user@mydomain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;This is the Subject&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBody</span><span style="color: #339933;">,</span> <span style="color: #000088;">$addHeaders</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In most of the cases there will be a requirement to embed images into HTML since the particular Email template will consists logos, photos etc.</p>
<p>There are actually two ways to do this.</p>
<ol>
<li>You can specify absolute paths to the images on your site.</li>
<li>You can attach images into the message and link it with a special URI.</li>
</ol>
<p>For the first method I will use the built-in mail() function itself.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">#Specify a From Address
</span><span style="color: #000088;">$addHeaders</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;From: webmaster@ourwebsite.com&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Set the content-type to send out the email in HTML
</span><span style="color: #000088;">$addHeaders</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;MIME-Version: 1.0&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$addHeaders</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-type:text/html;charset=iso-8859-1&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Mail Body consists Images with an absolute URI
</span><span style="color: #000088;">$mailBody</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;h1&gt;Hello World&lt;/h1&gt;
                 &lt;strong&gt;Example: &lt;/strong&gt;How to send a HTML Email with images
                 &lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://www.mydomain.com/images/photo.jpg<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user@mydomain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;This is the Subject&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBody</span><span style="color: #339933;">,</span> <span style="color: #000088;">$addHeaders</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>But this method has few drawbacks. Most of the Email clients do not allow displaying images from absolute URLS coz someone can track the people who will be opening this Email. Its a privacy issue, and you can enable to display images from absolute URLS in your Email client. But you can&#8217;t expect every user who will be checking this email to have this option enabled. So the best option is to use the second method.</p>
<p>Using the built-in mail() function to attach images and link it with a special URI can be a painful process in my opinion. It is possible but maintaining that code can be a real pain if the Email templates have to be modified over and over again.</p>
<p><b><a href="http://phpmailer.worxware.com/index.php" target="_blank">PHPMailer</a></b> is a life saver when it comes to sending Emails using PHP. Though the built-in mail() function fulfills  most of our requirements, special cases like SMTP authentication, attaching files, embedding images can be done effectively and easily with PHPMailer without doing any modification to the Server settings.</p>
<p>You need to download the PHPMailer library files from <a href="http://sourceforge.net/projects/phpmailer/" target="_blank">here</a> first.<br />
The following code explains how you can send Emails with inline images. I added the code for SMTP authentication as well.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class.phpmailer.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;class.smtp.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000088;">$mail</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PHPMailer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Follwing code segment uses a SMTP server to send email
</span><span style="color: #666666; font-style: italic;"># Comment this segment if you don't wish to use a SMTP server
</span><span style="color: #666666; font-style: italic;"># Use a SMTP Server
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">IsSMTP</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># SMTP Server address                  
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;smtp.mydomain.com&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;"># SMTP Port
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Port</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">25</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># Enable debug for SMTP (Only for testing purposes)
</span><span style="color: #666666; font-style: italic;"># 1 = errors and messages
</span><span style="color: #666666; font-style: italic;"># 2 = messages only
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SMTPDebug</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>              
&nbsp;
<span style="color: #666666; font-style: italic;"># From address and Name                                            
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFrom</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user@mydomain.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;User Display Name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Message Subject
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Subject</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Message Subject&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;"># Enable HTML Email
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">IsHTML</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;"># Embed Images into the Email Body
</span><span style="color: #666666; font-style: italic;"># Attach file logo.jpg and give it an identifier name 'logo'
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddEmbeddedImage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'logo.jpg'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'logo'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'logo.jpg'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;"># Attach file photo.jpg and and give it an identifier name 'photo'
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddEmbeddedImage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'photo.jpg'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'photo'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'photo.jpg'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;"># Use the identifier in the special URI format to link with the attached image
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Body</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;h1&gt;Hello World&lt;/h1&gt;
                &lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>cid:logo<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;
                   &lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>cid:photo<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># alternate text if the Email client doesn't support HTML
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AltBody</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;This is text only alternative body.&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Add recipients of the email
</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddAddress</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;you@yoursite.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddAddress</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;you@anothersite.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Send out the email 
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
    <span style="color: #666666; font-style: italic;">#if Email failed to send
</span>    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Email not sent&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">#Debug purposes only
</span>    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ErrorInfo</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If Email was successfully sent out
</span>    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Email sent&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/phpmailer-for-the-rescue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>100+ Resources for Web Developers</title>
		<link>http://www.nazly.net/100-resources-for-web-developers/</link>
		<comments>http://www.nazly.net/100-resources-for-web-developers/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 01:31:17 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.nazly.net/100-resources-for-web-developers/</guid>
		<description><![CDATA[This is a fantastic list for Web Developers. 100+ Resources for Web Developers From the Blogpost : There is some amazing stuff out there on the Web-resources, tools, tricks, and tips. Problem is, as a Web developer, you spend so (&#8230;)<p><a href="http://www.nazly.net/100-resources-for-web-developers/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>This is a fantastic list for Web Developers.<br />
<br /><a href="http://blog-well.com/2008/03/04/100-resources-for-web-developers/" target="_blank">100+ Resources for Web Developers</a></p>
<p>From the Blogpost :<br />
<br /><i>There is some amazing stuff out there on the Web-resources, tools, tricks, and tips. Problem is, as a Web developer, you spend so much of your time just keeping up with new technologies &#8211; learning, playing &#8211; and this doesn&#039;t leave much time to go hunting for the latest and greatest tool, or for a better way of doing things.</p>
<p>So we&#039;ve put together a list of over 100 resources to help make your life as a developer easier; where to find snippets of code, sites that automate processes, cheat sheets, lessons, useful tools and a couple of silly videos to give your brain a break if you make it through to the end. Please enjoy!</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/100-resources-for-web-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rock with RSS</title>
		<link>http://www.nazly.net/rock-with-rss/</link>
		<comments>http://www.nazly.net/rock-with-rss/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 02:29:26 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://blog.nazly.net/rock-with-rss/</guid>
		<description><![CDATA[Here is a list of tools that would help in managing RSS Feeds. 14 &#34;OTHER&#34; Ways to Use RSS Feeds]]></description>
			<content:encoded><![CDATA[<p>Here is a list of tools that would help in managing RSS Feeds. </p>
<p><a href="http://www.makeuseof.com/tag/14-other-ways-to-use-rss-feeds/" target="_blank">14 &quot;OTHER&quot; Ways to Use RSS Feeds</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/rock-with-rss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Search Tricks</title>
		<link>http://www.nazly.net/google-search-tricks/</link>
		<comments>http://www.nazly.net/google-search-tricks/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 06:29:43 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://blog.nazly.net/google-search-tricks/</guid>
		<description><![CDATA[Here is a list of Google Search Tricks which can be really handy at times. This list mostly has the tricks that are not in the Google Cheat Sheet. I didn&#039;t know Google Search can be used to get LIVE (&#8230;)<p><a href="http://www.nazly.net/google-search-tricks/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Here is a list of <a href="http://techtracer.com/2008/01/06/10-most-amazing-google-search-tricks/" target="_blank">Google Search Tricks</a> which can be really handy at times. This list mostly has the tricks that are not in the <a href="http://www.google.com/help/cheatsheet.html" target="_blank">Google Cheat Sheet</a>. I didn&#039;t know Google Search can be used to get LIVE Cricket scores. So people who cannot check LIVE scores because <a href="http://www.cricinfo.com" target="_blank">Cricinfo.com</a> is blocked by the administrator at your workplace, now you have an option. Of course they won&#039;t block Google <img src="http://www.nazly.net//smiles/icon_wink.gif" alt="[Wink]" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/google-search-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Spreadsheets</title>
		<link>http://www.nazly.net/google-spreadsheets/</link>
		<comments>http://www.nazly.net/google-spreadsheets/#comments</comments>
		<pubDate>Wed, 07 Jun 2006 01:04:03 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[spreadsheets]]></category>

		<guid isPermaLink="false">http://blog.nazly.net/google-spreadsheets/</guid>
		<description><![CDATA[This one is big time.. Google Spreadsheets (Limited Test)]]></description>
			<content:encoded><![CDATA[<p>This one is big time..<br />
<br /><a href="https://www.google.com/accounts/ServiceLogin?service=wise&amp;passive=true&amp;nui=1&amp;continue=http%3A%2F%2Fspreadsheets.google.com%2Fccc%3Fnew" target="_blank">Google Spreadsheets (Limited Test)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/google-spreadsheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag &amp; Drop on webpages</title>
		<link>http://www.nazly.net/drag-drop-on-webpages/</link>
		<comments>http://www.nazly.net/drag-drop-on-webpages/#comments</comments>
		<pubDate>Fri, 12 May 2006 12:17:10 +0000</pubDate>
		<dc:creator>Nazly</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[drag]]></category>
		<category><![CDATA[draganddrop]]></category>
		<category><![CDATA[drop]]></category>

		<guid isPermaLink="false">http://blog.nazly.net/drag-drop-on-webpages/</guid>
		<description><![CDATA[Anyone who has the necessity to drag &#38; drop images or layers should look into the DHTML API, Drag &#38; Drop for Images and Layers. Its a really cool API as I played around it quite a bit. Most importantly (&#8230;)<p><a href="http://www.nazly.net/drag-drop-on-webpages/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Anyone who has the necessity to drag &amp; drop images or layers should look into the <a href="http://www.walterzorn.com/dragdrop/dragdrop_e.htm" target="_blank">DHTML API, Drag &amp; Drop for Images and Layers</a>. Its a really cool API as I played around it quite a bit. Most importantly this library is a free software and released under LGPL.</p>
<p>The thing I like the most is the extendability of certain features. Also it has a very good documentation. I could easily add JavaScript code when an image is dragged or when dropped. I used Ajax in this case. When the user drags and drops an image I updated its position via Ajax to his user record on the server. So next time he logs in I could load the image in the position where he placed it last. Some basic stuff like that. It could really add a lot of interactivity to a webpage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nazly.net/drag-drop-on-webpages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

