<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development India – PHP, Ajax, ASP.NET</title>
	<atom:link href="http://www.phpasks.com/blogs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpasks.com/blogs</link>
	<description>Web site design and development, PHP, Ajax, ASP.NET</description>
	<lastBuildDate>Mon, 12 Dec 2011 09:01:42 +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>Get the Last Day of a Month using PHP</title>
		<link>http://www.phpasks.com/blogs/2011/04/get-the-last-day-of-a-month-using-php/</link>
		<comments>http://www.phpasks.com/blogs/2011/04/get-the-last-day-of-a-month-using-php/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 10:34:27 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tutorial]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1328</guid>
		<description><![CDATA[Picked this cool little PHP function to calculate and return the last day of a month for any year off the always informative lutrov interactive website the other day, and posted it here for future reference – because that’s just how I roll! Anyway, here goes: function lastday($month = '', $year = '',$format = 'Y-m-d') ]]></description>
			<content:encoded><![CDATA[<p>Picked this cool little PHP function to calculate and return the last day of a month for any year off the always informative lutrov interactive website the other day, and posted it here for future reference – because that’s just how I roll! <img src='http://www.phpasks.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Anyway, here goes:</p>
<pre class="php" style="font-family: monospace;"><span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> lastday<span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$month</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 255);">''</span><span style="color: rgb(51, 153, 51);">,</span> <span style="color: rgb(0, 0, 136);">$year</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 255);">''</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(0, 0, 136);">$format</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 255);">'Y-m-d'</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(0, 153, 0);">{</span>

   <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(153, 0, 0);">empty</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$month</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(0, 153, 0);">{</span>
      <span style="color: rgb(0, 0, 136);">$month</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'m'</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

   <span style="color: rgb(0, 153, 0);">}</span>
&nbsp;
   <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(153, 0, 0);">empty</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$year</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(0, 153, 0);">{</span>
      <span style="color: rgb(0, 0, 136);">$year</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'Y'</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

   <span style="color: rgb(0, 153, 0);">}</span>
&nbsp;
   <span style="color: rgb(0, 0, 136);">$result</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">strtotime</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">"<span style="color: rgb(0, 102, 153); font-weight: bold;">{$year}</span>-<span style="color: rgb(0, 102, 153); font-weight: bold;">{$month}</span>-01"</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

   <span style="color: rgb(0, 0, 136);">$result</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">strtotime</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'-1 second'</span><span style="color: rgb(51, 153, 51);">,</span> <span style="color: rgb(153, 0, 0);">strtotime</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'+1 month'</span><span style="color: rgb(51, 153, 51);">,</span> <span style="color: rgb(0, 0, 136);">$result</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

&nbsp;
   <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$format</span><span style="color: rgb(51, 153, 51);">,</span> <span style="color: rgb(0, 0, 136);">$result</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>
<span style="color: rgb(0, 153, 0);">}</span></pre>
<p>As you can see, usage is a simple matter of calling lastday() and feeding it the year and month you want it to return the last day for, though if you leave these two parameters out, it will simply return you the last date of the current month – all in a handy ISO 8601 formatting.</p>
<p>Useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2011/04/get-the-last-day-of-a-month-using-php/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP: Calculate the Number of Working Days in a Month</title>
		<link>http://www.phpasks.com/blogs/2011/04/php-calculate-the-number-of-working-days-in-a-month/</link>
		<comments>http://www.phpasks.com/blogs/2011/04/php-calculate-the-number-of-working-days-in-a-month/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 08:21:07 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tutorial]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1326</guid>
		<description><![CDATA[TweetHow to calculate the number of working days in a month, in other words discount Saturdays and Sundays from a month’s total number of days. It sounds pretty simple, but because of the shifting nature of the calendar we use, one can’t just take a guess and average it you know. No, we need a ]]></description>
			<content:encoded><![CDATA[            <a href="http://twitter.com/share" class="twitter-share-button" data-count="" data-text="PHP: Calculate the Number of Working Days in a Month" data-via="" data-url="http://www.phpasks.com/blogs/2011/04/php-calculate-the-number-of-working-days-in-a-month/" >Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><p>How to calculate the number of working days in a month, in other words discount Saturdays and Sundays from a month’s total number of days.</p>
<p>It sounds pretty simple, but because of the shifting nature of the calendar we use, one can’t just take a guess and average it you know. No, we need a function to work out this total for each month of any particular year.</p>
<p>Now of course I’m sure there are for more acute, beautiful or elegant solutions to this particular problem out there, but I for one quite like the idea of seeing the logic behind what is happening step by step, which is exactly why I came up with this little function to do the work for me.</p>
<p>So in order to calculate the number of working days in a month by removing Saturdays and Sundays from its day count, have a look at this simple PHP function:</p>
<pre class="php" style="font-family: monospace;"><span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> calculateWorkingDaysInMonth<span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$year</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 255);">''</span><span style="color: rgb(51, 153, 51);">,</span> <span style="color: rgb(0, 0, 136);">$month</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 255);">''</span><span style="color: rgb(0, 153, 0);">)</span>

<span style="color: rgb(0, 153, 0);">{</span>
	<span style="color: rgb(102, 102, 102); font-style: italic;">//in case no values are passed to the function, use the current month and year</span>
	<span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$year</span> <span style="color: rgb(51, 153, 51);">==</span> <span style="color: rgb(0, 0, 255);">''</span><span style="color: rgb(0, 153, 0);">)</span>
	<span style="color: rgb(0, 153, 0);">{</span>

		<span style="color: rgb(0, 0, 136);">$year</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'Y'</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>
	<span style="color: rgb(0, 153, 0);">}</span>
	<span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$month</span> <span style="color: rgb(51, 153, 51);">==</span> <span style="color: rgb(0, 0, 255);">''</span><span style="color: rgb(0, 153, 0);">)</span>

	<span style="color: rgb(0, 153, 0);">{</span>
		<span style="color: rgb(0, 0, 136);">$month</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'m'</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>
	<span style="color: rgb(0, 153, 0);">}</span>
	<span style="color: rgb(102, 102, 102); font-style: italic;">//create a start and an end datetime value based on the input year </span>

	<span style="color: rgb(0, 0, 136);">$startdate</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">strtotime</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$year</span> <span style="color: rgb(51, 153, 51);">.</span> <span style="color: rgb(0, 0, 255);">'-'</span> <span style="color: rgb(51, 153, 51);">.</span> <span style="color: rgb(0, 0, 136);">$month</span> <span style="color: rgb(51, 153, 51);">.</span> <span style="color: rgb(0, 0, 255);">'-01'</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

	<span style="color: rgb(0, 0, 136);">$enddate</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">strtotime</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'+'</span> <span style="color: rgb(51, 153, 51);">.</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'t'</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(0, 0, 136);">$startdate</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(51, 153, 51);">-</span> <span style="color: rgb(204, 102, 204);">1</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">.</span> <span style="color: rgb(0, 0, 255);">' days'</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(0, 0, 136);">$startdate</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

	<span style="color: rgb(0, 0, 136);">$currentdate</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 136);">$startdate</span><span style="color: rgb(51, 153, 51);">;</span>
	<span style="color: rgb(102, 102, 102); font-style: italic;">//get the total number of days in the month	</span>
	<span style="color: rgb(0, 0, 136);">$return</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">intval</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'t'</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(0, 0, 136);">$startdate</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(204, 102, 204);">10</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>

	<span style="color: rgb(102, 102, 102); font-style: italic;">//loop through the dates, from the start date to the end date</span>
	<span style="color: rgb(177, 177, 0);">while</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 136);">$currentdate</span> <span style="color: rgb(51, 153, 51);">&lt;=</span> <span style="color: rgb(0, 0, 136);">$enddate</span><span style="color: rgb(0, 153, 0);">)</span>
	<span style="color: rgb(0, 153, 0);">{</span>

		<span style="color: rgb(102, 102, 102); font-style: italic;">//if you encounter a Saturday or Sunday, remove from the total days count</span>
		<span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'D'</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(0, 0, 136);">$currentdate</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(51, 153, 51);">==</span> <span style="color: rgb(0, 0, 255);">'Sat'</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(51, 153, 51);">||</span> <span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(153, 0, 0);">date</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'D'</span><span style="color: rgb(51, 153, 51);">,</span><span style="color: rgb(0, 0, 136);">$currentdate</span><span style="color: rgb(0, 153, 0);">)</span> <span style="color: rgb(51, 153, 51);">==</span> <span style="color: rgb(0, 0, 255);">'Sun'</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(0, 153, 0);">)</span>

		<span style="color: rgb(0, 153, 0);">{</span>
			<span style="color: rgb(0, 0, 136);">$return</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(0, 0, 136);">$return</span> <span style="color: rgb(51, 153, 51);">-</span> <span style="color: rgb(204, 102, 204);">1</span><span style="color: rgb(51, 153, 51);">;</span>
		<span style="color: rgb(0, 153, 0);">}</span>

		<span style="color: rgb(0, 0, 136);">$currentdate</span> <span style="color: rgb(51, 153, 51);">=</span> <span style="color: rgb(153, 0, 0);">strtotime</span><span style="color: rgb(0, 153, 0);">(</span><span style="color: rgb(0, 0, 255);">'+1 day'</span><span style="color: rgb(51, 153, 51);">,</span> <span style="color: rgb(0, 0, 136);">$currentdate</span><span style="color: rgb(0, 153, 0);">)</span><span style="color: rgb(51, 153, 51);">;</span>
	<span style="color: rgb(0, 153, 0);">}</span> <span style="color: rgb(102, 102, 102); font-style: italic;">//end date walk loop</span>

	<span style="color: rgb(102, 102, 102); font-style: italic;">//return the number of working days</span>
	<span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 136);">$return</span><span style="color: rgb(51, 153, 51);">;</span>
<span style="color: rgb(0, 153, 0);">}</span></pre>
<p>As you can see, the logic of the function is pretty straightforward to follow. To use the function in your code, simply call it and pass the month and year you want it to examine, meaning that</p>
<p>    calculateWorkingDaysInMonth(2010,04);</p>
<p>is going to result in 22.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2011/04/php-calculate-the-number-of-working-days-in-a-month/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Pagination with jQuery, MySQL and PHP</title>
		<link>http://www.phpasks.com/blogs/2011/02/pagination-with-jquery-mysql-and-php/</link>
		<comments>http://www.phpasks.com/blogs/2011/02/pagination-with-jquery-mysql-and-php/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 10:43:39 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Pagging]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1320</guid>
		<description><![CDATA[Demo I received lot of requests from my readers that asked to me how to implement Pagination with jQuery, PHP and MySQL. so I had developed a simple tutorial. It&#8217;s looks big but very simple script. The tutorial contains three PHP files and two js files includes jQuery plugin. -config.php (Database Configuration) -pagination.php -pagination_data.php -jquery.js ]]></description>
			<content:encoded><![CDATA[<p><a href="http://phpasks.com/pagging/pagination.php">Demo</a></p>
<p>I received lot of requests from my readers that asked to me how to implement Pagination with jQuery, PHP and MySQL. so I had developed a simple tutorial. It&#8217;s looks big but very simple script.</p>
<div id="attachment_1319" class="wp-caption alignleft" style="width: 460px"><img class="size-full wp-image-1319" title="pagination" src="http://www.phpasks.com/blogs/wp-content/uploads/2011/02/pagination.png" alt="pagination" width="450" height="114" /><p class="wp-caption-text">pagination</p></div>
<p>The tutorial contains three PHP files and two js files includes jQuery  plugin.</p>
<p>-config.php (Database  Configuration)<br />
-pagination.php<br />
-pagination_data.php<br />
-jquery.js<br />
-jquery_pagination.js</p>
<p><strong>Database Table</strong></p>
<div>CREATE TABLE <strong>messages</strong><br />
(<br />
<span style="color: #cc0000;">msg_id</span> INT <span style="color: blue;">PRIMARY  KEY</span> <span style="color: #a64d79;">AUTO_INCREMENT</span>,<br />
<span style="color: #cc0000;">message</span> TEXT<br />
);</div>
<p><strong>jquery_pagination.js</strong><br />
Contains javascript this script works like a data  controller.</p>
<div>$(<strong><span style="color: #a64d79;">document</span></strong>).ready(<strong>function</strong>()<br />
{</p>
<div style="color: orange;">//Display Loading Image</div>
<p><strong>function</strong><span style="color: #cc0000;"> Display_Load</span>()<br />
{<br />
$(<span style="color: blue;">&#8220;#loading&#8221;</span>).<strong><span style="color: #a64d79;">fadeIn</span></strong>(<span style="color: #cc0000;">900</span>,<span style="color: #cc0000;">0</span>);<br />
$(<span style="color: blue;">&#8220;#loading&#8221;</span>).<strong>html</strong>(<span style="color: blue;">&#8220;&lt;img src=&#8221;bigLoader.gif&#8221; /&gt;&#8221;</span>);<br />
}</p>
<div style="color: orange;">//Hide Loading Image</div>
<p><strong>function</strong> <span style="color: #cc0000;">Hide_Load</span>()<br />
{<br />
$(<span style="color: blue;">&#8220;#loading&#8221;</span>).<strong>fadeOut</strong>(<span style="color: blue;">&#8216;slow&#8217;</span>);<br />
};</p>
<div style="color: orange;">//Default Starting Page Results</div>
<p>$(<span style="color: blue;">&#8220;#pagination li:first&#8221;</span>)<br />
.<strong>css</strong>({<span style="color: blue;">&#8216;color&#8217; </span>: <span style="color: blue;">&#8216;#FF0084&#8242;</span>}).<strong>css</strong>({<span style="color: blue;">&#8216;border&#8217;</span> : <span style="color: blue;">&#8216;none&#8217;</span>});<br />
<span style="color: #cc0000;">Display_Load</span>();<br />
$(<span style="color: blue;">&#8220;#content&#8221;</span>).<strong>load</strong>(<span style="color: blue;">&#8220;pagination_data.php?page=1&#8243;</span>, <span style="color: #cc0000;">Hide_Load</span>());</p>
<div style="color: orange;">//Pagination Click</div>
<p>$(<span style="color: blue;">&#8220;#pagination li&#8221;</span>).<strong>click</strong>(<strong>function</strong>(){<br />
<span style="color: #cc0000;">Display_Load</span>();</p>
<div style="color: orange;">//CSS Styles</div>
<p>$(<span style="color: blue;">&#8220;#pagination li&#8221;</span>)<br />
.<strong>css</strong>({<span style="color: blue;">&#8216;border&#8217; </span>:<span style="color: blue;"> &#8216;solid #dddddd 1px&#8217;</span>})<br />
.<strong>css</strong>({<span style="color: blue;">&#8216;color&#8217;</span> : <span style="color: blue;">&#8216;#0063DC&#8217;</span>});</p>
<p>$(<strong>this</strong>)<br />
.<strong>css</strong>({<span style="color: blue;">&#8216;color&#8217; </span>:<span style="color: blue;"> &#8216;#FF0084&#8242;</span>})<br />
.<strong>css</strong>({<span style="color: blue;">&#8216;border&#8217;</span> : <span style="color: blue;">&#8216;none&#8217;</span>});</p>
<div style="color: orange;">//Loading Data</div>
<p><strong>var</strong> pageNum =<span style="color: #073763;"> </span><strong>this</strong>.id;<br />
$(<span style="color: blue;">&#8220;#content&#8221;</span>).<strong><span style="color: #a64d79;">load</span></strong>(<span style="color: blue;">&#8220;pagination_data.php?page=&#8221; </span>+ pageNum, <span style="color: #cc0000;">Hide_Load</span>());<br />
});</p>
<p>});</p></div>
<p><strong>config.php</strong><br />
You have to change hostname, username, password and  databasename.</p>
<div>
<div style="color: #cc0000;"><strong>&lt;?php</strong></div>
<p>$mysql_hostname = <span style="color: #cc0000;">&#8220;localhost&#8221;</span>;<br />
$mysql_user = <span style="color: #cc0000;">&#8220;username&#8221;</span>;<br />
$mysql_password = <span style="color: #cc0000;">&#8220;password&#8221;</span>;<br />
$mysql_database = <span style="color: #cc0000;">&#8220;database&#8221;</span>;<br />
$bd = <span style="color: blue;">mysql_connect</span>($mysql_hostname, $mysql_user,  $mysql_password)<br />
or <span style="color: blue;">die</span>(<span style="color: #cc0000;">&#8220;Opps some thing went wrong&#8221;</span>);<br />
<span style="color: blue;">mysql_select_db</span>($mysql_database, $bd)<br />
or <span style="color: blue;">die</span>(<span style="color: #cc0000;">&#8220;Opps some thing  went wrong&#8221;</span>);</p>
<div style="color: #cc0000;"><strong>?&gt;</strong></div>
</div>
<p><strong>pagination.php</strong><br />
User interface page.</p>
<div>
<div style="color: #cc0000;"><strong>&lt;?php</strong></div>
<p><span style="color: #38761d;">include</span>(<span style="color: #cc0000;">&#8216;config.php&#8217;</span>);<br />
$per_page = <span style="color: #cc0000;">9</span>;</p>
<p><span style="color: orange;">//Calculating no of page</span>s<br />
$sql = <span style="color: orange;">&#8220;select * from messages&#8221;</span>;<br />
$result = <span style="color: blue;">mysql_query</span>($sql);<br />
$count = <span style="color: blue;">mysql_num_rows</span>($result);<br />
$pages =<span style="color: blue;"> ceil</span>($count/$per_page)</p>
<div style="color: #cc0000;"><strong>?&gt;</strong></div>
<p><span style="color: #990000;">&lt;script</span> type=&#8221;<span style="color: #0b5394;">text/javascript</span>&#8221; src=&#8221;<span style="color: #0b5394;">http://ajax.googleapis.com/ajax/<br />
libs/jquery/1.3.0/jquery.min.js</span>&#8220;<span style="color: #990000;">&gt;</span><span style="color: #990000;">&lt;/script&gt;</span><br />
<span style="color: #990000;">&lt;script</span> type=&#8221;<span style="color: #0b5394;">text/javascript</span>&#8221; src=&#8221;<span style="color: #0b5394;">jquery_pagination.js</span>&#8220;<span style="color: #990000;">&gt;</span><span style="color: #990000;">&lt;/script&gt;</span></p>
<div style="color: #073763;"><strong>&lt;div id=&#8221;</strong><span style="color: blue;">loading</span><strong>&#8221; &gt;&lt;/div&gt;</strong></div>
<div style="color: #073763;"><strong>&lt;div id=&#8221;</strong><span style="color: blue;">content</span><strong>&#8221; &gt;&lt;/div&gt;</strong></div>
<div style="color: #a64d79;"><strong>&lt;ul id=&#8221;<span style="color: blue;">pagination</span>&#8220;&gt;</strong></div>
<div style="color: #cc0000;"><strong>&lt;?php</strong></div>
<div style="color: orange;">//Pagination Numbers</div>
<p><span style="color: #38761d;">for</span>($i<span style="color: blue;">=</span><span style="color: #cc0000;">1</span>; $i<span style="color: blue;">&lt;=</span>$pages;  $i<span style="color: blue;">++</span>)<br />
{<br />
<span style="color: blue;">echo</span><span style="color: #cc0000;"> &#8216;&lt;li  id=&#8221;&#8216;</span><strong><span style="color: blue;">.</span></strong>$i<strong>.</strong><span style="color: #cc0000;">&#8216;&#8221;&gt;&#8217;</span><strong>.</strong>$i<strong>.</strong><span style="color: #cc0000;">&#8216;&lt;/li&gt;&#8217;</span>;<br />
}</p>
<div style="color: #cc0000;"><strong>?&gt;</strong></div>
<div style="color: #a64d79;"><strong>&lt;/ul&gt;</strong></div>
</div>
<p><strong>pagination_data.php</strong><br />
Simple php script display data from the messages  table.</p>
<div>
<div style="color: #cc0000;"><strong>&lt;?php</strong></div>
<p><span style="color: #38761d;">include</span>(<span style="color: #cc0000;">&#8216;config.php&#8217;</span>);<br />
$per_page = <span style="color: #cc0000;">9</span>;<br />
if(<span style="color: #0b5394;">$_GET</span>)<br />
{<br />
$page=<span style="color: #0b5394;">$_GET</span>[<span style="color: #cc0000;">'page'</span>];<br />
}</p>
<p>$start = ($page-<span style="color: #cc0000;">1</span>)<span style="color: blue;">*</span>$per_page;<br />
$sql =<span style="color: #cc0000;"> &#8220;select * from messages order by msg_id limit  $start,$per_page&#8221;</span>;<br />
$result = <span style="color: blue;">mysql_query</span>($sql);</p>
<div style="color: #cc0000;"><strong>?&gt;</strong></div>
<p>&lt;table width=&#8221;800px&#8221;&gt;</p>
<div style="color: #cc0000;"><strong>&lt;?php</strong></div>
<p>while($row = <span style="color: blue;">mysql_fetch_array</span>($result))<br />
{<br />
$msg_id=$row[<span style="color: #cc0000;">'msg_id'</span>];<br />
$message=$row[<span style="color: #cc0000;">'message'</span>];</p>
<div style="color: #cc0000;"><strong>?&gt;</strong></div>
<p>&lt;tr&gt;<br />
&lt;td&gt;<strong><span style="color: #cc0000;">&lt;?php</span></strong> <span style="color: blue;">echo</span> $msg_id; <strong><span style="color: #cc0000;">?&gt;</span></strong>&lt;/td&gt;<br />
&lt;td&gt;<strong>&lt;?php</strong> <span style="color: blue;">echo</span> $message; <strong><span style="color: #cc0000;">?&gt;</span></strong>&lt;/td&gt;<br />
&lt;/tr&gt;</p>
<div style="color: #cc0000;"><strong>&lt;?php</strong></div>
<p>}</p>
<div style="color: #cc0000;"><strong>?&gt;</strong></div>
<p>&lt;/table&gt;</p></div>
<p><strong>CSS Code</strong><br />
CSS code for page numbers.</p>
<div>
<div style="color: #a64d79;"><strong>#loading </strong></div>
<p>{<br />
width: 100%;<br />
position: absolute;<br />
}</p>
<div style="color: #a64d79;"><strong>li</strong></div>
<p>{<br />
list-style: none;<br />
float:  left;<br />
margin-right: 16px;<br />
padding:5px;<br />
border:solid 1px  #dddddd;<br />
color:#0063DC;<br />
}</p>
<div style="color: #a64d79;"><strong>li:hover</strong></div>
<p>{<br />
color:#FF0084;<br />
cursor: pointer;<br />
}</p>
<p>Live : <a href="http://phpasks.com/pagging/pagination.php">Demo</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2011/02/pagination-with-jquery-mysql-and-php/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Google Ranking Checker Class in PHP</title>
		<link>http://www.phpasks.com/blogs/2010/12/google-ranking-checker-class-in-php/</link>
		<comments>http://www.phpasks.com/blogs/2010/12/google-ranking-checker-class-in-php/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 12:45:44 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rank Checking]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1316</guid>
		<description><![CDATA[The only goal for an SEO is a good or very good google ranking. To ensure this you have to monitor your rankings and compare it to the positions of your competitors. With the Google AJAX Search API and my little PHP Class you can easy build a Google Ranking Checker … The class needs ]]></description>
			<content:encoded><![CDATA[<p>The only goal for an SEO is a good or very good google ranking. To ensure this you have to monitor your rankings and compare it to the positions of your competitors. With the Google <a href="http://code.google.com/apis/ajaxsearch/signup.html">AJAX Search API</a> and my little PHP Class you can easy build a Google Ranking Checker …<br />
<br />
The class needs an Google API key for the AJAX Search API (get it here) … it&#8217;s just one field and a click and you can start. You can check multiple keywords for multiple domains or urls, just pass this two arrays to the check() method.<br />
</p>
<pre style="font-family: monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">Class</span> RankingChecker <span style="color: #009900;">{</span>

	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$googleApiKey</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>

	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$googleBaseUrl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://ajax.googleapis.com/ajax/services/search/web?v=1.0'</span><span style="color: #339933;">;</span>

	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$checkPageCount</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>

	<span style="color: #009933; font-style: italic;">/**
	 * get an api key from: http://code.google.com/apis/ajaxsearch/signup.html
	 * @param string $googleApiKey
	 * @param int $checkPageCount
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">(</span><span style="color: #000088;">$googleApiKey</span><span style="color: #339933;">,</span> <span style="color: #000088;">$checkPageCount</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">googleApiKey</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$googleApiKey</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkPageCount</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$checkPageCount</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">}</span>

	<span style="color: #009933; font-style: italic;">/**
	 * get rankings
	 * @example $checker-&gt;check(array('phpasks'), array('phpasks.com'));
	 * @param array $keywords search these keywords
	 * @param array $domains domains to compare against
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> check<span style="color: #009900;">(</span><span style="color: #000088;">$keywords</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domains</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>

		<span style="color: #000088;">$rankings</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">(</span><span style="color: #000088;">$keywords</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span> throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">(</span><span style="color: #0000ff;">'Keywords array is no array'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #009900;">}</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">(</span><span style="color: #000088;">$domains</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span> throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">(</span><span style="color: #0000ff;">'Domains array is no array'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #009900;">}</span>

		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$keywords</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$keyword</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
			<span style="color: #000088;">$keyword</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
			    <span style="color: #b1b100;">for</span><span style="color: #009900;">(</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkPageCount</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		    		<span style="color: #000088;">$start</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$i</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span>
		    		<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'%s&amp;hl=de&amp;gl=AT&amp;q=%s&amp;rsz=8&amp;key=%s&amp;start=%s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">googleBaseUrl</span><span style="color: #339933;">,</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">(</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">googleApiKey</span><span style="color: #339933;">,</span> <span style="color: #000088;">$start</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

		    	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">(</span><span style="color: #000088;">$url</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		    			<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">(</span><span style="color: #000088;">$result</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
		    			<span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">(</span><span style="color: #000088;">$rows</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">responseData</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
		    	    <span style="color: #009900;">}</span>
		    	<span style="color: #009900;">}</span>

		    	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$domains</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$url</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		    		<span style="color: #000088;">$rankings</span><span style="color: #009900;">[</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #000088;">$url</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">;</span>
		    		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$rows</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$position</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		    			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">strpos</span><span style="color: #009900;">(</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$url</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		    				<span style="color: #000088;">$rankings</span><span style="color: #009900;">[</span><span style="color: #000088;">$keyword</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #000088;">$url</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$position</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		    				<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		    			<span style="color: #009900;">}</span>
		    		<span style="color: #009900;">}</span>
		    	<span style="color: #009900;">}</span>
			<span style="color: #009900;">}</span>
		<span style="color: #009900;">}</span>	

		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$rankings</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">}</span>

<span style="color: #009900;">}
</span>//$keywords[0] = 'adult dating';
//$website[0] = 'adultxdating.com';
?&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;title&gt;Google Ranking Checker Class in PHP5 by PHPASKS&lt;/title&gt;
 &lt;style type="text/css"&gt;
 body { font:12px arial,helvetica,sans-serif; padding:20px; }
 #info { margin-bottom:20px; }
 form { float:left; background:#f1f1f1; padding:20px; background:#f1f1f1; width:380px; }
 form textarea { width:100%; }
 table { float:left; width:380px; margin-left:10px; }
 table td { border:1px solid #eee; padding:5px; }
 .user { background:#fff; padding:5px; list-style-type:none; }
 h1 { font-size:20px; margin:0; }
 h2 { margin:0 0 10px 0; }
 button { position:absolute; right:0; bottom:0; font-size:20px; padding:5px 10px; margin:40px; }
 &lt;/style&gt;
&lt;/head&gt;
&lt;body id="body" onload="init()"&gt;

 &lt;div id="info"&gt;
 &lt;h1&gt;Google Ranking Checker Class &lt;br /&gt;&lt;/h1&gt;
 &lt;/div&gt;
 &lt;form action="&lt;?=$_SERVER['PHP_SELF']?&gt;" method="post"&gt;
 &lt;label&gt;Keywords &lt;small&gt;(max. 5)&lt;/small&gt;:&lt;/label&gt;
 &lt;textarea rows="5" cols="50" name="keywords"&gt;&lt;?=$_POST["keywords"]?&gt;&lt;/textarea&gt;        
 &lt;label&gt;Domains:&lt;/label&gt;

 &lt;textarea rows="5" cols="50" name="website"&gt;&lt;?=$_POST["website"]?&gt;&lt;/textarea&gt;
 &lt;input type="submit" name="check" value="Check now" /&gt;
 &lt;/form&gt;
 &lt;table&gt;

 &lt;?php
 if(isset($_POST["check"]))
 {
 $keywords = explode(",",$_POST["keywords"]);
 $website = explode(",",$_POST["website"]);
 $RankingChecker = new RankingChecker('ABQIAAAAT0QYHPdhh7eyjzLSB5OrohQDB0iR9tbFmh1rKcNxqCRfRwKkyBQlv_4XYljSF-KiMYSm1bu_oiXDrw', 5);
 $rankings = $RankingChecker-&gt;check($keywords,$website);
 //echo "&lt;pre&gt;".print_r($rankings)."&lt;/pre&gt;";
 while(list($key,$val) = each($rankings))
 {
 echo "&lt;tr&gt;";
 echo "&lt;td&gt;".$key."&lt;/td&gt;";
 while(list($key1,$val1) = each($val))
 {
 echo "&lt;td&gt;".$key1."&lt;/td&gt;";    
 echo "&lt;td&gt;".$val1."&lt;/td&gt;";
 }
 echo "&lt;/tr&gt;";
 }
 }
 ?&gt;
 &lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/12/google-ranking-checker-class-in-php/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>PHP backlink checker script</title>
		<link>http://www.phpasks.com/blogs/2010/11/php-backlink-checker-script/</link>
		<comments>http://www.phpasks.com/blogs/2010/11/php-backlink-checker-script/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 07:11:17 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1312</guid>
		<description><![CDATA[This is probably the simplest script that anyone knowing (or even learning) PHP can create in about 15seconds. But I will still post it here just in case anyone is a total noob at PHP. Purpose of this script: To check a certain given backlink on hundreds of webpages provided you know the URL of ]]></description>
			<content:encoded><![CDATA[<p style="font-size: 13px; line-height: 1.4em; color: #63565f;">This is probably the simplest script that anyone knowing (or even learning) PHP can create in about 15seconds. But I will still post it here just in case anyone is a total noob at PHP.</p>
<p style="font-size: 13px; line-height: 1.4em; color: #63565f;"><strong>Purpose of this script</strong>: To check a certain given backlink on hundreds of webpages provided you know the URL of every webpage.</p>
<pre style="width: auto; clear: none; overflow-x: visible; overflow-y: visible; font-size: 12px; line-height: 1.333; white-space: pre; font-family: monospace; margin: 0px;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>

<span style="color: #000088;">$source</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">(</span><span style="color: #0000ff;">"source.txt"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$needle</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">"www.IamtryingtocheckThisPage"</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">//without http as I have imploded the http later in the script</span>
<span style="color: #000088;">$new</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">,</span><span style="color: #000088;">$source</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$new</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$check</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">(</span><span style="color: #0000ff;">"http://"</span><span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$check</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">strpos</span><span style="color: #009900;">(</span><span style="color: #000088;">$a</span><span style="color: #339933;">,</span><span style="color: #000088;">$needle</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #000088;">$found</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$check</span><span style="color: #339933;">;</span>
	 <span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span>
	 <span style="color: #000088;">$notfound</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$check</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">}</span>
						<span style="color: #009900;">}</span>

<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">"Matches that were found: <span style="color: #000099; font-weight: bold;">\n</span> "</span><span style="color: #339933;">.</span><span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">,</span><span style="color: #000088;">$found</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">"Matches that were not found <span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">.</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">,</span><span style="color: #000088;">$notfound</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<pre style="width: auto; clear: none; overflow-x: visible; overflow-y: visible; font-size: 12px; line-height: 1.333; white-space: pre; font-family: monospace; margin: 0px;"><strong>
</strong></pre>
<pre style="width: auto; clear: none; overflow-x: visible; overflow-y: visible; font-size: 12px; line-height: 1.333; white-space: pre; font-family: monospace; margin: 0px;"><strong>or Other way</strong></pre>
<pre style="width: auto; clear: none; overflow-x: visible; overflow-y: visible; font-size: 12px; line-height: 1.333; white-space: pre; font-family: monospace; margin: 0px;"><strong>&lt;?php
function check_back_link($remote_url, $your_link) {
    $match_pattern = preg_quote(rtrim($your_link, "/"), "/");
    $found = false;
    if ($handle = @fopen($remote_url, "r")) {
        while (!feof($handle)) {
            $part = fread($handle, 1024);
            if (preg_match("/&lt;a(.*)href=[\"']".$match_pattern.
"(\/?)[\"'](.*)&gt;(.*)&lt;\/a&gt;/", $part)) {
                $found = true;
                break;
            }
        }
        fclose($handle);
    }
    return $found;
}
// example:
//if (check_back_link("http://www.abc.com", "http://www.xyz.com")) echo "link exists";
?&gt;</strong></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/11/php-backlink-checker-script/feed/</wfw:commentRss>
		<slash:comments>289</slash:comments>
		</item>
		<item>
		<title>Simple Symfony Login Form Example</title>
		<link>http://www.phpasks.com/blogs/2010/10/simple-symfony-login-form-example/</link>
		<comments>http://www.phpasks.com/blogs/2010/10/simple-symfony-login-form-example/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 05:13:52 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Symfony MVC]]></category>
		<category><![CDATA[Symfony login page]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1309</guid>
		<description><![CDATA[There are times when I just need a simple login form that checks for a certain username and password combination in order to lockdown a backend administration interface. The new sfForm sub-framework in Symfony 1.1/1.2 makes it really easy to reuse a Form class for this. If you’re unfamiliar with the new sfForm sub-framework, you ]]></description>
			<content:encoded><![CDATA[<p>There are times when I just need a simple login form that checks for a certain username and password combination in order to lockdown a backend administration interface. The new sfForm sub-framework in Symfony 1.1/1.2 makes it really easy to reuse a Form class for this. If you’re unfamiliar with the new sfForm sub-framework, you should probably start with the <a onclick="javascript:_gaq.push(['_trackEvent','outbound-article','www.symfony-project.org']);" href="http://www.symfony-project.org/book/forms/1_2/en/">Forms Book</a>. Here’s an example form (placed in <code>lib/form</code>):</p>
<pre><code><span>&lt;?php</span>

<span>class</span> LoginForm <span>extends</span> sfForm
{
  <span>public</span> <span>function</span> configure()
  {
    <span>$this</span>-&gt;setWidgets(<span>array</span>(
      <span>'username'</span> =&gt; <span>new</span> sfWidgetFormInput(),
      <span>'password'</span> =&gt; <span>new</span> sfWidgetFormInputPassword()
    ));

    <span>$this</span>-&gt;widgetSchema-&gt;setNameFormat(<span>'login[%s]'</span>);

    <span>$this</span>-&gt;setValidators(<span>array</span>(
      <span>'username'</span> =&gt; <span>new</span> sfValidatorChoice(<span>array</span>(<span>'required'</span> =&gt; true, <span>'choices'</span> =&gt; <span>array</span>(<span>'admin'</span>))),
      <span>'password'</span> =&gt; <span>new</span> sfValidatorChoice(<span>array</span>(<span>'required'</span> =&gt; true, <span>'choices'</span> =&gt; <span>array</span>(<span>'some_password'</span>)))
    ));
  }
}
</code></pre>
<p>The key here is using <code>sfValidatorChoice</code> to ensure that the input matches some predefined keys (“admin” and “some_password” in this case).</p>
<p>For completeness, here’s the action file:</p>
<pre><code><span>&lt;?php</span>

<span>class</span> authActions <span>extends</span> sfActions
{
  <span>public</span> <span>function</span> executeLogin(sfWebRequest <span>$request</span>)
  {
    <span>$this</span>-&gt;form = <span>new</span> LoginForm();

    <span>if</span> (<span>$request</span>-&gt;isMethod(<span>'post'</span>))
    {
      <span>$this</span>-&gt;form-&gt;bind(<span>$request</span>-&gt;getParameter(<span>'login'</span>));
      <span>if</span> (<span>$this</span>-&gt;form-&gt;isValid())
      {
        <span>// authenticate user and redirect them</span>
        <span>$this</span>-&gt;getUser()-&gt;setAuthenticated(true);
        <span>$this</span>-&gt;getUser()-&gt;addCredential(<span>'user'</span>);
        <span>$this</span>-&gt;redirect(<span>'home/index'</span>);
      }
    }
  }

  <span>public</span> <span>function</span> executeLogout()
  {
    <span>$this</span>-&gt;getUser()-&gt;clearCredentials();
    <span>$this</span>-&gt;getUser()-&gt;setAuthenticated(false);
    <span>$this</span>-&gt;redirect(<span>'@homepage'</span>);
  }
}
</code></pre>
<p>And the template file <code>loginSuccess.php</code>:</p>
<pre><code><span>&lt;<span>form</span><span><span> action=<span>"&lt;?php echo url_for('auth/login') ?&gt;"</span></span><span> method=<span>"POST"</span></span>&gt;</span></span>
  <span>&lt;<span>table</span><span>&gt;</span></span>
    <span>&lt;?php echo $form ?&gt;</span>
    <span>&lt;<span>tr</span><span>&gt;</span></span>
      <span>&lt;<span>td</span><span><span> colspan=<span>"2"</span></span>&gt;</span></span>
        <span>&lt;<span>input</span><span><span> type=<span>"submit"</span></span> /&gt;</span></span>
      <span>&lt;/<span>td</span><span>&gt;</span></span>
    <span>&lt;/<span>tr</span><span>&gt;</span></span>
  <span>&lt;/<span>table</span><span>&gt;</span></span>
<span>&lt;/<span>form</span><span>&gt;</span></span>
</code></pre>
<p>And of course, you’ll want to turn on security for the application in <code>security.yml</code>:</p>
<pre><code><span>default</span>:
  is_secure: <span>on</span>
  credentials: <span>user</span>
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/10/simple-symfony-login-form-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Table Structure for Storing Multi Level Category Data</title>
		<link>http://www.phpasks.com/blogs/2010/07/create-table-structure-for-storing-multi-level-category-data/</link>
		<comments>http://www.phpasks.com/blogs/2010/07/create-table-structure-for-storing-multi-level-category-data/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 06:39:01 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Nth Level Category]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1305</guid>
		<description><![CDATA[Somebody asking about how to create table structure to store multilevel category data. Here is the scenario. For example you will create an online article system and each article will have specified category. So how about the table structure to handle this? First you create the table for store the category, let’s say the table ]]></description>
			<content:encoded><![CDATA[<p><!-- by Sony AK --><img class="alignleft size-full wp-image-1306" title="tree-150x150" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/07/tree-150x150.jpg" alt="tree-150x150" width="150" height="150" />Somebody asking about how to create table structure to store multilevel category data. Here is the scenario. For example you will create an online article system and each article will have specified category. So how about the table structure to handle this?</p>
<p>First you create the table for store the category, let’s say the table name is tbl_category. The structure is like this.</p>
<pre>+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| id            | int(11)      | NO   | PRI | NULL    | auto_increment |
| category_name | varchar(100) | YES  |     | NULL    |                |
| parent_id     | int(11)      | YES  |     | NULL    |                |
+---------------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)</pre>
<p>Now we will explain the field one-by-one.</p>
<p>- Field <strong>id</strong>, is used to store the table primary key, it’s auto-increment value.<br />
- Field <strong>category_name</strong>, is used to store the name of the category.<br />
- Field <strong>parent_id</strong>, is used to store the parent id of specified category name, with this field you can store multilevel category data on single table.</p>
<p>Example data of tbl_category is like below.</p>
<pre>mysql&gt; select * from tbl_category;
+----+---------------+-----------+
| id | category_name | parent_id |
+----+---------------+-----------+
|  1 | PHP           |      NULL |
|  2 | Animal        |      NULL |
|  3 | Frameworks    |         1 |
|  4 | CakePHP       |         3 |
|  5 | CodeIgniter   |         3 |
|  6 | Horse         |         2 |
|  7 | Dog           |         2 |
|  8 | Dalmatians    |         7 |
+----+---------------+-----------+
8 rows in set (0.00 sec)</pre>
<p>Above data represents category tree like below.</p>
<pre>+- PHP
|-- Frameworks
|--- CakePHP
|--- CodeIgniter
+- Animal
|-- Horse
|-- Dog
|--- Dalmatians</pre>
<p>It means category name PHP and Animal is the root category. PHP has Frameworks sub-category and Frameworks has two sub-category again, CakePHP and CodeIgniter. Animal has two sub-category, Horse and Dog. Dog has one sub-category called Dalmatians. All those data can be stored on single table structure like tbl_category above.</p>
<p>Now suppose you have table article called tbl_article, the structure is like below.</p>
<pre>mysql&gt; desc tbl_article;
+-------------+---------------+------+-----+---------+----------------+
| Field       | Type          | Null | Key | Default | Extra          |
+-------------+---------------+------+-----+---------+----------------+
| id          | int(11)       | NO   | PRI | NULL    | auto_increment |
| title       | varchar(100)  | YES  |     | NULL    |                |
| content     | varchar(1024) | YES  |     | NULL    |                |
| category_id | int(11)       | YES  |     | NULL    |                |
+-------------+---------------+------+-----+---------+----------------+
4 rows in set (0.06 sec)</pre>
<p>You can fill category_id with id field from tbl_category. The example is like below.</p>
<pre>mysql&gt; select * from tbl_article\G
*************************** 1. row ***************************
         id: 1
      title: CakePHP is easy framework
    content: CakePHP is very easy framework in the world.
category_id: 4
*************************** 2. row ***************************
         id: 2
      title: Dalmatians dog killed by pedestrian
    content: A big dalmatians dog killed by pedestrian on Downing Street, London.
category_id: 8
2 rows in set (0.00 sec)</pre>
<p>We can see that article with ID 1 has category_id 4, it means it’s category is CakePHP. Article ID 2 has category_id 8, it means it’s category is Dalmatians.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/07/create-table-structure-for-storing-multi-level-category-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: Displaying Categories and Current Subcategories</title>
		<link>http://www.phpasks.com/blogs/2010/06/magento-displaying-categories-and-current-subcategories/</link>
		<comments>http://www.phpasks.com/blogs/2010/06/magento-displaying-categories-and-current-subcategories/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 05:40:40 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>
		<category><![CDATA[Magento Categories]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1300</guid>
		<description><![CDATA[I started “skinning” Magento today with a design that I was given. The functionality called for was a left category navigation (on every page but customer pages and cart/checkout pages) that always displayed the main categories – but when you click on a category, Magento should take you to that category’s listing, but also display ]]></description>
			<content:encoded><![CDATA[<p>I started “skinning” Magento today with a design that I was given. The functionality called for was a left category navigation (on every page but customer pages and cart/checkout pages) that always displayed the main categories – but when you click on a category, Magento should take you to that category’s listing, but also display the current subcategories.</p>
<p>So – since we all know that the Magento documentation is pretty crappy at this time, I had to do a lot of digging through core files, and a lot of time just with trial and error. But, I finally did come up with something that works. I’m willing to bet that there is a better, more proper way to do it, but regardless, this seems to be working perfectly.</p>
<p>What I did was create a new PHTML file, created the proper block call in page.xml, and now I’ve got a</p>
<p>great working (and looking!) left-navigation.  Here’s the home page (left), and a category page (right):</p>
<div style="border: 1px solid #777777; width: 282px; height: 504px; float: left; margin-left: 30px;"><img class="aligncenter size-full wp-image-1301" title="nav-left" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/06/nav-left.jpg" alt="nav-left" width="282" height="504" /></div>
<div style="border: 1px solid #777777; width: 282px; height: 504px; float: right; margin-right: 30px;"><img class="aligncenter size-full wp-image-1302" title="nav-right" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/06/nav-right.jpg" alt="nav-right" width="282" height="504" /></div>
<p><br style="clear: both;" /></p>
<p>And the code:</p>
<div>
<table border="0">
<tbody>
<tr>
<td>
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</pre>
</td>
<td>
<pre style="font-family: monospace;">&lt;h3&gt;Browse by Category:&lt;/h3&gt;

&lt;ul&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Mage_Catalog_Block_Navigation<span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$store_cats</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreCategories</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$current_cat</span> 	<span style="color: #339933;">=</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCurrentCategory</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

<span style="color: #000088;">$current_cat</span>	<span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #990000;">is_object</span><span style="color: #009900;">(</span><span style="color: #000088;">$current_cat</span><span style="color: #009900;">)</span> ? <span style="color: #000088;">$current_cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$store_cats</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cat</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$current_cat</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href="'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCategoryUrl</span><span style="color: #009900;">(</span><span style="color: #000088;">$cat</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'"&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"&lt;/a&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCurrentChildCategories</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$subcat</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href="'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCategoryUrl</span><span style="color: #009900;">(</span><span style="color: #000088;">$subcat</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'"&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$subcat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"&lt;/a&gt;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">}</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">"&lt;/ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href="'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCategoryUrl</span><span style="color: #009900;">(</span><span style="color: #000088;">$cat</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'"&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"&lt;/a&gt;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">}</span>
<span style="color: #009900;">}</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/ul&gt;</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>If you know of a better way to do this – please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/06/magento-displaying-categories-and-current-subcategories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento &#8211; Special Offer Product Listing</title>
		<link>http://www.phpasks.com/blogs/2010/05/magento-special-offer-product-listing/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/magento-special-offer-product-listing/#comments</comments>
		<pubDate>Fri, 28 May 2010 10:46:05 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>
		<category><![CDATA[Special Offer Magento]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1294</guid>
		<description><![CDATA[One of my recent articles was on the subject of sorting “On Sale” product in Magento. The following is a cleaner and more advanced look at how—with few tricks and smart moves—you can reuse existing Magento code and modify it to suit your needs. Product can be “on sale” in two ways: 1. when an ]]></description>
			<content:encoded><![CDATA[<p>One of my recent articles was on the subject of sorting “On Sale” product in Magento. The following is a cleaner and more advanced look at how—with few tricks and smart moves—you can reuse existing Magento code and modify it to suit your needs.</p>
<p>Product can be “on sale” in two ways:</p>
<p>1. when an item has a special price assigned to it on the individual level, or</p>
<p>2. when a special promotion “covers” the item</p>
<p>It is important to remember that you don’t have to set up the special price on each product to get it to be on sale; you can simply create a promotion rule and say something like “Set all the products in Category X to be on sale.”</p>
<p>I provided few screenshots at the bottom of this article to provide a closer look at what I’m talking about. I will not go into too much details here since this is a bit more advanced HOW TO, but here is the process in a nutshell:</p>
<p>First, create a copy of /catalog/product/list.phtml file and name it onsale_list.phtml. Here is my version of onsale_list.phtml file.</p>
<p>Second,  “activate” this new file. There are few ways you can do this. Let’s say you wish to assign this onsale_list.phtml on one of our categories, named “On Sale,” for instance.</p>
<p>We then go to Categories &gt; Manage Categories &gt; On Sale… select Custom design and under Custom layout update, place the following:</p>
<p>product_list_toolbar</p>
<p>If you now go to your category On Sale, it should only show products you have assigned to category “On sale” that have a special price set to them.</p>
<p>If you now wish to apply Promotion rules to entire “On sale” category, then you simply assign a rule to one item, and all the items assigned to the same “On sale” category (covered by promotion rules) will be automatically listed in the grid.</p>
<p>Basically, the magic is in one simple IF statement</p>
<p><strong>&lt; ?php if(($_product-&gt;special_price !== null) or ($_product-&gt;_rule_price !== null)): ?&gt;</strong></p>
<p>for each block that lists products.</p>
<p>Check out the screenshots, they explain a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/magento-special-offer-product-listing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento &#8211; How to show new products in category list</title>
		<link>http://www.phpasks.com/blogs/2010/05/magento-how-to-show-new-products-in-category-list/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/magento-how-to-show-new-products-in-category-list/#comments</comments>
		<pubDate>Fri, 28 May 2010 10:33:49 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>
		<category><![CDATA[New Product Magento]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1290</guid>
		<description><![CDATA[Guy Labbé — blog about Web &#38; graphic design Magento : How to show new products in category list In any normal e-commerce website, it is a good thing to obviously show which products are new. This way you attract attention of your regular visitors and maybe you sell more and you extend the lifetime ]]></description>
			<content:encoded><![CDATA[<p>Guy Labbé — blog about Web &amp; graphic design<br />
Magento : How to show new products in category list</p>
<p>In any normal e-commerce website, it is a good thing to obviously show which products are new. This way you attract attention of your regular visitors and maybe you sell more and you extend the lifetime customer value. Anyway, it is pretty normal to put these new products in front of others in the catalog, or at least to make them conspicuous.</p>
<p>Although Magento allows you to configure start and end dates for a product in order to show it as new, the default Magento template doesn&#8217;t show it. This is the goal of this mini-tutorial : to show you how to show new products among old ones in a category list.</p>
<p>In fact, this is not complicated, you only have to know how to do it. This information I&#8217;ve found on this forum (french) doesn&#8217;t seem to be well known over the internet, but giving such informations might help a lot improving the Magento Community. Anyway. I&#8217;ve summerized it, put it in a real example, and even provided it as a download for lazy developers.</p>
<p>First, in the product page of some product in Magento&#8217;s backend, insert starting and ending dates for its newness state. To do a test, put (of course) a date before today&#8217;s date, and a date which is later as today&#8217;s date.</p>
<p>The code to add to access newness dates of a product is the following :</p>
<div>
<div style="font-family: monospace;">
<ol>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #666666; font-style: italic;">// Limit dates for newness</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000088;">$newFromDate</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;catalog/product&#8217;</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">(</span><span style="color: #000088;">$_product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getID</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNewsFromDate</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000088;">$newToDate</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;catalog/product&#8217;</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">(</span><span style="color: #000088;">$_product</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getID</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNewsToDate</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;"></li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #666666; font-style: italic;">// Date and time (now)</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000088;">$now</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date" target="_blank"><span style="color: #990000;">date</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8220;Y-m-d H:m:s&#8221;</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;"></li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #b1b100;">if</span><span style="color: #009900;">(</span><span style="color: #000088;">$newFromDate</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$now</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$newToDate</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$now</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&#8220;nv&#8221;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #009900;">}</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div>
</li>
</ol>
<div style="font-family: monospace;">OR You can used in for loop</div>
<div style="font-family: monospace;"><span><span style="margin-left: 56px;"><code>if</code><code>(</code><code>strtotime</code><code>(</code><code>$_product</code><code>-&gt;</code></span></span>getNewsFromDate<span><span style="margin-left: 56px;"><code>()) &lt; time()&amp;&amp; </code></span></span><span><span style="margin-left: 56px;"><code>strtotime</code><code>(</code><code>$_product</code><code>-&gt;getNewsToDate()) &gt; time()) {</code></span></span></div>
<p>Variables $newFromDate and $newToDate get start and end dates of the active product during the loop. This data is only available if you did insert dates values in your product page. If you don&#8217;t see any change when you&#8217;ll reload the page, you may have not did this <img src='http://www.phpasks.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The path of the file where to insert this code is named list.phtml is the following (just replace <strong>yourtheme</strong> by name of the theme you&#8217;re using, <strong>default</strong> is default one) :</p>
<p>/app/design/frontend/default/yourtheme/template/catalog/product/list.phtml</p>
<p>To add code for « list » mode, go to line 47, after this start of loop :</p>
<div>
<div style="font-family: monospace;">
<ol>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$_productCollection</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$_product</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div>
</li>
</ol>
<p>For « grid » mode, go to line 93, after the same code as for « list » mode, or almost.</p>
<p>In both cases, you can place the code wherever you want, as soon it is within the loop. Here is what end of loops look like :</p>
<div>
<div style="font-family: monospace;">
<ol>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div>
</li>
</ol>
<p>If you followed this tutorial correctly, you should see at list a product with mention «<strong> This is new! </strong>».</div>
</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/magento-how-to-show-new-products-in-category-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento – Display new products on the home page</title>
		<link>http://www.phpasks.com/blogs/2010/05/magento-%e2%80%93-display-new-products-on-the-home-page/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/magento-%e2%80%93-display-new-products-on-the-home-page/#comments</comments>
		<pubDate>Thu, 27 May 2010 12:31:46 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1288</guid>
		<description><![CDATA[If you’ve ever wanted to add new products in your Magento home page, it’s fairly easy to implement. Go to “CMS” then “Manage Pages” and select “Home Page” from the list of pages. Now paste this code snippet to show products labeled as “new” on your front page: IN Home PAGE: {{block type=&#8221;catalog/product_new&#8221; name=&#8221;home.catalog.product.new&#8221; alias=&#8221;product_homepage&#8221; ]]></description>
			<content:encoded><![CDATA[<p>If you’ve ever wanted to add new products in your Magento home page, it’s fairly easy to implement. Go to “CMS” then “Manage Pages” and select “Home Page” from the list of pages. Now paste this code snippet to show products labeled as “new” on your front page:<br />
IN Home PAGE:<br />
{{block type=&#8221;catalog/product_new&#8221; name=&#8221;home.catalog.product.new&#8221; alias=&#8221;product_homepage&#8221; template=&#8221;catalog/product/new.phtml&#8221;}}<br />
(Note that you must have some new products in your catalog for anything to show when you do this. This doesn’t mean that you’ve recently added them; only products explicitly marked as new using “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin tool will be shown.)</p>
<p>Static Block Created then called:</p>
<p><?=$this->getLayout()->createBlock(&#8216;cms/block&#8217;)->setBlockId(&#8216;new-product-launch&#8217;)->toHtml()?></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/magento-%e2%80%93-display-new-products-on-the-home-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Paggination problem in magento 1.4.1 part 2</title>
		<link>http://www.phpasks.com/blogs/2010/05/magento-paggination-problem-in-magento-1-4-1-part-2/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/magento-paggination-problem-in-magento-1-4-1-part-2/#comments</comments>
		<pubDate>Thu, 27 May 2010 06:14:15 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1284</guid>
		<description><![CDATA[I have to say that the stable version of magento 1.4.1 is not that stable!! &#8212; Magento &#8211; Please release the CE version with checking the unimplemented methods in the core code. &#8212; Magento &#8211; I have found and solve the problem of toolbars display error for the new magento 1.4.1 first of all, for ]]></description>
			<content:encoded><![CDATA[<p>I have to say that the stable version of magento 1.4.1 is not that stable!! &#8212; Magento &#8211;<br />
Please release the CE version with checking the unimplemented methods in the core code. &#8212; Magento &#8211;<br />
I have found and solve the problem of toolbars display error for the new magento 1.4.1<br />
first of all, for more developers (Magento) if you want to see the errors prints in the frontend without checking errors using a reference number</p>
<p>which means you can just rename the local.xml.sample to local.xml to make all the error message print in the frondend.</p>
<p>Now you may have the errors for the toolbar pager as most of CE user will have their custom theme and the 1.3.2 and older all follow the same theme structure but in 1.4.0+ they change the toolbar class</p>
<div><code> <span style="color: #0000bb;">Mage_Catalog_Block_Product_List_Toolbar </span><span style="color: #007700;">extends </span><span style="color: #0000bb;">Mage_Core_Block_Template</span></code></div>
<div>which used to be</div>
<div>
<div><code> <span style="color: #007700;">class </span><span style="color: #0000bb;">Mage_Catalog_Block_Product_List_Toolbar </span><span style="color: #007700;">extends </span><span style="color: #0000bb;">Mage_Page_Block_Html_Pager</span></code></div>
<div>but now they add a mothed to show the pager which listing the pages in Mage_Catalog_Block_Product_List_Toolbar the toolbar.phtml there is code</div>
<div><code>&lt;?php<br />
/**<br />
* Magento<br />
*<br />
* NOTICE OF LICENSE<br />
*<br />
* This source file is subject to the Academic Free License (AFL 3.0)<br />
* that is bundled with this package in the file LICENSE_AFL.txt.<br />
* It is also available through the world-wide-web at this URL:<br />
* http://opensource.org/licenses/afl-3.0.php<br />
* If you did not receive a copy of the license and are unable to<br />
* obtain it through the world-wide-web, please send an email<br />
* to license@magentocommerce.com so we can send you a copy immediately.<br />
*<br />
* DISCLAIMER<br />
*<br />
* Do not edit or add to this file if you wish to upgrade Magento to newer<br />
* versions in the future. If you wish to customize Magento for your<br />
* needs please refer to http://www.magentocommerce.com for more information.<br />
*<br />
* @category   design_blank<br />
* @package    Mage<br />
* @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)<br />
* @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)<br />
*/<br />
?&gt;<br />
&lt;?php<br />
/**<br />
* Product list toolbar<br />
*<br />
* @see Mage_Catalog_Block_Product_List_Toolbar<br />
*/<br />
?&gt;<br />
&lt;?php if($this-&gt;getCollection()-&gt;getSize()): ?&gt;<br />
&lt;div&gt;<br />
&lt;p&gt;<br />
&lt;?php if($this-&gt;getLastPageNum()&gt;1): ?&gt;<br />
&lt;?php echo $this-&gt;__('Items %s to %s of %s total', $this-&gt;getFirstNum(), $this-&gt;getLastNum(), $this-&gt;getTotalNum()) ?&gt;<br />
&lt;?php else: ?&gt;<br />
&lt;?php echo $this-&gt;__('%s Item(s)', $this-&gt;getTotalNum()) ?&gt;<br />
&lt;?php endif; ?&gt;<br />
&lt;/p&gt;</p>
<p>&lt;fieldset&gt;<br />
&lt;label&gt;&lt;?php echo $this-&gt;__('Show') ?&gt;&lt;/label&gt;<br />
&lt;select onchange="setLocation(this.value)"&gt;<br />
&lt;?php foreach ($this-&gt;getAvailableLimit() as  $_key=&gt;$_limit): ?&gt;<br />
&lt;option value="&lt;?php echo $this-&gt;getLimitUrl($_key) ?&gt;"&lt;?php if($this-&gt;isLimitCurrent($_key)): ?&gt; selected="selected"&lt;?php endif ?&gt;&gt;<br />
&lt;?php echo $_limit ?&gt;<br />
&lt;/option&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;/select&gt; &lt;?php echo $this-&gt;__('per page') ?&gt;<br />
&lt;/fieldset&gt;</p>
<p>&lt;?php if($this-&gt;getLastPageNum()&gt;1): ?&gt;<br />
&lt;div&gt;<br />
&lt;strong&gt;&lt;?php echo $this-&gt;__('Page:') ?&gt;&lt;/strong&gt;<br />
&lt;ol&gt;<br />
&lt;?php if (!$this-&gt;isFirstPage()): ?&gt;<br />
&lt;li&gt;&lt;a href="&lt;?php echo $this-&gt;getPreviousPageUrl() ?&gt;"&gt;&lt;img src="&lt;?php echo $this-&gt;getSkinUrl('images/pager_arrow_left.gif') ?&gt;" alt="&lt;?php echo $this-&gt;__('Previous') ?&gt;" /&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php endif ?&gt;<br />
&lt;?php foreach ($this-&gt;getPages() as $_page): ?&gt;<br />
&lt;?php if ($this-&gt;isPageCurrent($_page)): ?&gt;<br />
&lt;li&gt;&lt;span&gt;&lt;?php echo $_page ?&gt;&lt;/span&gt;&lt;/li&gt;<br />
&lt;?php else: ?&gt;<br />
&lt;li&gt;&lt;a href="&lt;?php echo $this-&gt;getPageUrl($_page) ?&gt;"&gt;&lt;?php echo $_page ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php endif ?&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;?php if (!$this-&gt;isLastPage()): ?&gt;<br />
&lt;li&gt;&lt;a href="&lt;?php echo $this-&gt;getNextPageUrl() ?&gt;"&gt;&lt;img src="&lt;?php echo $this-&gt;getSkinUrl('images/pager_arrow_right.gif') ?&gt;" alt="&lt;?php echo $this-&gt;__('Next') ?&gt;" /&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php endif ?&gt;<br />
&lt;/ol&gt;<br />
&lt;/div&gt;<br />
&lt;?php endif; ?&gt;<br />
&lt;/div&gt;</p>
<p>&lt;?php if( $this-&gt;isExpanded() ): ?&gt;<br />
&lt;div&gt;<br />
&lt;?php if( $this-&gt;isEnabledViewSwitcher() ): ?&gt;<br />
&lt;p&gt;<br />
&lt;?php $_modes = $this-&gt;getModes(); ?&gt;<br />
&lt;?php if($_modes &amp;&amp; count($_modes)&gt;1): ?&gt;<br />
&lt;?php echo $this-&gt;__('View as') ?&gt;:<br />
&lt;?php foreach ($this-&gt;getModes() as $_code=&gt;$_label): ?&gt;<br />
&lt;?php if($this-&gt;isModeActive($_code)): ?&gt;<br />
&lt;strong&gt;&lt;?php echo $_label ?&gt;&lt;/strong&gt;&amp;nbsp;<br />
&lt;?php else: ?&gt;<br />
&lt;a href="&lt;?php echo $this-&gt;getModeUrl($_code) ?&gt;"&gt;&lt;?php echo $_label ?&gt;&lt;/a&gt;&amp;nbsp;<br />
&lt;?php endif; ?&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;?php endif; ?&gt;<br />
&lt;/p&gt;<br />
&lt;?php endif; ?&gt;</p>
<p>&lt;fieldset&gt;<br />
&lt;label&gt;&lt;?php echo $this-&gt;__('Sort by') ?&gt;&lt;/label&gt;<br />
&lt;select onchange="setLocation(this.value)"&gt;<br />
&lt;?php foreach($this-&gt;getAvailableOrders() as $_key=&gt;$_order): ?&gt;<br />
&lt;option value="&lt;?php echo $this-&gt;getOrderUrl($_key, 'asc') ?&gt;"&lt;?php if($this-&gt;isOrderCurrent($_key)): ?&gt; selected="selected"&lt;?php endif; ?&gt;&gt;<br />
&lt;?php echo $_order ?&gt;<br />
&lt;/option&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;/select&gt;<br />
&lt;?php if($this-&gt;getCurrentDirection() == 'desc'): ?&gt;<br />
&lt;a href="&lt;?php echo $this-&gt;getOrderUrl(null, 'asc') ?&gt;"&gt;&lt;img src="&lt;?php echo $this-&gt;getSkinUrl('images/sort_desc_arrow.gif') ?&gt;" alt="&lt;?php echo $this-&gt;__('Set Ascending Direction') ?&gt;" /&gt;&lt;/a&gt;<br />
&lt;?php else: ?&gt;<br />
&lt;a href="&lt;?php echo $this-&gt;getOrderUrl(null, 'desc') ?&gt;"&gt;&lt;img src="&lt;?php echo $this-&gt;getSkinUrl('images/sort_asc_arrow.gif') ?&gt;" alt="&lt;?php echo $this-&gt;__('Set Descending Direction') ?&gt;" /&gt;&lt;/a&gt;<br />
&lt;?php endif; ?&gt;<br />
&lt;/fieldset&gt;<br />
&lt;/div&gt;<br />
&lt;?php endif; ?&gt;<br />
&lt;?php endif ?&gt;</code></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/magento-paggination-problem-in-magento-1-4-1-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Paggination problem in magento 1.4.1</title>
		<link>http://www.phpasks.com/blogs/2010/05/magento-paggination-problem-in-magento-1-4-1/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/magento-paggination-problem-in-magento-1-4-1/#comments</comments>
		<pubDate>Thu, 27 May 2010 06:10:45 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1280</guid>
		<description><![CDATA[I have to say that the stable version of magento 1.4.1 is not that stable!! Please release the CE version with checking the unimplemented methods in the core code. I have found and solve the problem of toolbars display error for the new magento 1.4.1 first of all, for more developers if you want to ]]></description>
			<content:encoded><![CDATA[<p>I have to say that the stable version of magento 1.4.1 is not that stable!!<br />
Please release the CE version with checking the unimplemented methods in the core code.<br />
I have found and solve the problem of toolbars display error for the new magento 1.4.1<br />
first of all, for more developers if you want to see the errors prints in the frontend without checking errors using a reference number<br />
do the following in the SSH or use your ftp.</p>
<div><code> <span style="color: #0000bb;">cd errors</span><span style="color: #007700;">/<br />
</span><span style="color: #0000bb;">cp local</span><span style="color: #007700;">.</span><span style="color: #0000bb;">xml</span><span style="color: #007700;">.</span><span style="color: #0000bb;">sample </span><span style="color: #007700;">./</span><span style="color: #0000bb;">local</span><span style="color: #007700;">.</span><span style="color: #0000bb;">xml</span></code></div>
<div>which means you can just rename the local.xml.sample to local.xml to make all the error message print in the frondend.Now you may have the errors for the toolbar pager as most of CE user will have their custom theme and the 1.3.2 and older all follow the same theme structure but in 1.4.0+ they change the toolbar class</p>
<div><code> <span style="color: #0000bb;">Mage_Catalog_Block_Product_List_Toolbar </span><span style="color: #007700;">extends </span><span style="color: #0000bb;">Mage_Core_Block_Template</span></code></div>
<div>which used to be</div>
<div>
<div><code> <span style="color: #007700;">class </span><span style="color: #0000bb;">Mage_Catalog_Block_Product_List_Toolbar </span><span style="color: #007700;">extends </span><span style="color: #0000bb;">Mage_Page_Block_Html_Pager</span></code></div>
<div>but now they add a mothed to show the pager which listing the pages in Mage_Catalog_Block_Product_List_Toolbar the toolbar.phtml there is code</div>
<div>
<div><code> <span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getPagerHtml</span><span style="color: #007700;">() </span><span style="color: #0000bb;">?&gt;</span></code></div>
<div>which call this method</div>
<div><code>/**<br />
* Render pagination HTML<br />
*<br />
* @return string<br />
*/<br />
<span style="color: #007700;">public function </span><span style="color: #0000bb;">getPagerHtml</span><span style="color: #007700;">()<br />
</span><span style="color: #0000bb;">{<br />
$pagerBlock </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getChild</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'product_list_toolbar_pager'</span><span style="color: #007700;">);</p>
<p>if (</p>
<p></span><span style="color: #0000bb;">$pagerBlock </span><span style="color: #007700;">instanceof </span><span style="color: #0000bb;">Varien_Object</span><span style="color: #007700;">) </span><span style="color: #0000bb;">{</p>
<p></span><span style="color: #ff8000;">/* @var $pagerBlock Mage_Page_Block_Html_Pager */<br />
</span><span style="color: #0000bb;">$pagerBlock</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">setAvailableLimit</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getAvailableLimit</span><span style="color: #007700;">());</p>
<p></span><span style="color: #0000bb;">$pagerBlock</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">setUseContainer</span><span style="color: #007700;">(</span><span style="color: #0000bb;">false</span><span style="color: #007700;">)<br />
-&gt;</span><span style="color: #0000bb;">setShowPerPage</span><span style="color: #007700;">(</span><span style="color: #0000bb;">false</span><span style="color: #007700;">)<br />
-&gt;</span><span style="color: #0000bb;">setShowAmounts</span><span style="color: #007700;">(</span><span style="color: #0000bb;">false</span><span style="color: #007700;">)<br />
-&gt;</span><span style="color: #0000bb;">setLimitVarName</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getLimitVarName</span><span style="color: #007700;">())<br />
-&gt;</span><span style="color: #0000bb;">setPageVarName</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getPageVarName</span><span style="color: #007700;">())<br />
-&gt;</span><span style="color: #0000bb;">setLimit</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getLimit</span><span style="color: #007700;">())<br />
-&gt;</span><span style="color: #0000bb;">setFrameLength</span><span style="color: #007700;">(</span><span style="color: #0000bb;">Mage</span><span style="color: #007700;">::</span><span style="color: #0000bb;">getStoreConfig</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'design/pagination/pagination_frame'</span><span style="color: #007700;">))<br />
-&gt;</span><span style="color: #0000bb;">setJump</span><span style="color: #007700;">(</span><span style="color: #0000bb;">Mage</span><span style="color: #007700;">::</span><span style="color: #0000bb;">getStoreConfig</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'design/pagination/pagination_frame_skip'</span><span style="color: #007700;">))<br />
-&gt;</span><span style="color: #0000bb;">setCollection</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getCollection</span><span style="color: #007700;">());</p>
<p>return</p>
<p></span><span style="color: #0000bb;">$pagerBlock</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">toHtml</span><span style="color: #007700;">();<br />
</span><span style="color: #0000bb;">}</p>
<p></span><span style="color: #007700;">return </span><span style="color: #dd0000;">''</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">}</span></code></div>
<div>but they have not implement the method of setUseContainer(false) and setShowAmounts(false)<br />
to solve this problem first you need to add a child to toolbar which is too simple in their release note saying “In layout of any custom theme the usage of catalog/product_list_toolbar block should be changed to page/html_pager:<br />
1) Replace the catalog/product/list/toolbar.phtml of your theme by the new one<br />
2) Update catalog.xml layout: &lt;block type=&#8221;catalog/product_list_toolbar&#8221; name=&#8221;product_list_toolbar&#8221; template=&#8221;catalog/product/list/toolbar.phtml&#8221;&gt; should be replaced into &lt;block type=&#8221;page/html_pager&#8221; name=&#8221;product_list_toolbar_pager&#8221;/&gt; “<br />
the correct way should be add this to the catalog.xml</div>
<div>
<div><code> <span style="color: #007700;">&lt;</span><span style="color: #0000bb;">catalog_category_default</span><span style="color: #007700;">&gt;<br />
&lt;!-- &lt;</span><span style="color: #0000bb;">reference name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"left"</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">block type</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/navigation" </span><span style="color: #0000bb;">name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog.leftnav" </span><span style="color: #0000bb;">after</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"currency" </span><span style="color: #0000bb;">template</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/navigation/left.phtml"</span><span style="color: #007700;">/&gt;<br />
&lt;/</span><span style="color: #0000bb;">reference</span><span style="color: #007700;">&gt; --&gt;<br />
&lt;</span><span style="color: #0000bb;">reference name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"content"</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">block type</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/category_view" </span><span style="color: #0000bb;">name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"category.products" </span><span style="color: #0000bb;">template</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/category/view.phtml"</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">block type</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/product_list" </span><span style="color: #0000bb;">name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"product_list" </span><span style="color: #0000bb;">template</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/product/list.phtml"</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">block type</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/product_list_toolbar" </span><span style="color: #0000bb;">name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"product_list_toolbar" </span><span style="color: #0000bb;">template</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"catalog/product/list/toolbar.phtml"</span><span style="color: #007700;">&gt;<br />
&lt;!-- </span><span style="color: #0000bb;">The following code shows how to set your own pager increments </span><span style="color: #007700;">--&gt;<br />
&lt;!--<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"setDefaultListPerPage"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">4</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"setDefaultGridPerPage"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">9</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"addPagerLimit"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;list&lt;/</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">2</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"addPagerLimit"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;list&lt;/</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">4</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"addPagerLimit"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;list&lt;/</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">6</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"addPagerLimit"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;list&lt;/</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">8</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"addPagerLimit" </span><span style="color: #0000bb;">translate</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"label"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;list&lt;/</span><span style="color: #0000bb;">mode</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">all</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">limit</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">label</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">All</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">label</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
--&gt;<br />
&lt;</span><span style="color: #0000bb;">block type</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"page/html_pager" </span><span style="color: #0000bb;">name</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"product_list_toolbar_pager"</span><span style="color: #007700;">/&gt;<br />
&lt;/</span><span style="color: #0000bb;">block</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">action method</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"setToolbarBlockName"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">name</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">product_list_toolbar</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">name</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">action</span><span style="color: #007700;">&gt;<br />
&lt;/</span><span style="color: #0000bb;">block</span><span style="color: #007700;">&gt;<br />
&lt;/</span><span style="color: #0000bb;">block</span><span style="color: #007700;">&gt;<br />
&lt;/</span><span style="color: #0000bb;">reference</span><span style="color: #007700;">&gt;<br />
&lt;/</span><span style="color: #0000bb;">catalog_category_default</span><span style="color: #007700;">&gt;</span></code></div>
<div>there is 2 place to add &lt;block type=&#8221;page/html_pager&#8221; name=&#8221;product_list_toolbar_pager&#8221;/&gt; within the &lt;block type=&#8221;catalog/product_list_toolbar&#8221; name=&#8221;product_list_toolbar&#8221; template=&#8221;catalog/product/list/toolbar.phtml&#8221;&gt;<br />
which can make it as a child of toolbar otherwise you can’t call method of getChild in the toolbar.php<br />
after that you may need to add the method to page/html/pager.php which i will hack the core code as I can handle all the update and even though make a local overwrite class is better but I don’t want any more update as they release all the errors “stable” version I will have to check everything after updated so I prefer hard code it.</div>
<div>
<div><code> <span style="color: #007700;">class </span><span style="color: #0000bb;">Mage_Page_Block_Html_Pager </span><span style="color: #007700;">extends </span><span style="color: #0000bb;">Mage_Core_Block_Template<br />
{<br />
</span><span style="color: #007700;">protected </span><span style="color: #0000bb;">$_collection </span><span style="color: #007700;">= </span><span style="color: #0000bb;">null</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_pageVarName </span><span style="color: #007700;">= </span><span style="color: #dd0000;">'p'</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_limitVarName </span><span style="color: #007700;">= </span><span style="color: #dd0000;">'limit'</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_availableLimit </span><span style="color: #007700;">= array(</span><span style="color: #0000bb;">10</span><span style="color: #007700;">=&gt;</span><span style="color: #0000bb;">10</span><span style="color: #007700;">,</span><span style="color: #0000bb;">20</span><span style="color: #007700;">=&gt;</span><span style="color: #0000bb;">20</span><span style="color: #007700;">,</span><span style="color: #0000bb;">50</span><span style="color: #007700;">=&gt;</span><span style="color: #0000bb;">50</span><span style="color: #007700;">);<br />
protected </span><span style="color: #0000bb;">$_dispersion </span><span style="color: #007700;">= </span><span style="color: #0000bb;">3</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_displayPages </span><span style="color: #007700;">= </span><span style="color: #0000bb;">5</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_showPerPage </span><span style="color: #007700;">= </span><span style="color: #0000bb;">true</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_limit </span><span style="color: #007700;">= </span><span style="color: #0000bb;">null</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_outputRequired </span><span style="color: #007700;">= </span><span style="color: #0000bb;">true</span><span style="color: #007700;">;<br />
protected </span><span style="color: #0000bb;">$_showAmount </span><span style="color: #007700;">= </span><span style="color: #0000bb;">true</span><span style="color: #007700;">; </span><span style="color: #ff8000;">// added attributes<br />
</span><span style="color: #007700;">protected </span><span style="color: #0000bb;">$_showContainer </span><span style="color: #007700;">= </span><span style="color: #0000bb;">true</span><span style="color: #007700;">; </span><span style="color: #ff8000;">//added attributes</span></code></div>
<div>and at the end of the file add</div>
<div>
<div><code> <span style="color: #007700;">public function </span><span style="color: #0000bb;">setShowAmounts</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$varName</span><span style="color: #007700;">)<br />
</span><span style="color: #0000bb;">{<br />
$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">_showAmount </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$varName</span><span style="color: #007700;">;<br />
return </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">}<br />
</span><span style="color: #007700;">public function </span><span style="color: #0000bb;">getShowAmounts</span><span style="color: #007700;">()<br />
</span><span style="color: #0000bb;">{<br />
</span><span style="color: #007700;">return </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">_showAmount</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">}<br />
</span><span style="color: #007700;">public function </span><span style="color: #0000bb;">setUseContainer</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$varName</span><span style="color: #007700;">)<br />
</span><span style="color: #0000bb;">{<br />
$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">_showContainer </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$varName</span><span style="color: #007700;">;<br />
return </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">}<br />
</span><span style="color: #007700;">public function </span><span style="color: #0000bb;">getShowContainer</span><span style="color: #007700;">()<br />
</span><span style="color: #0000bb;">{<br />
</span><span style="color: #007700;">return </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">_showContainer</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">}</span></code></div>
<div>then you still need to change the pager.phtml file</div>
<div><code><span style="color: #ff8000;"> *<br />
* @see Mage_Page_Block_Html_Pager<br />
*/<br />
</span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getCollection</span><span style="color: #007700;">()-&gt;</span><span style="color: #0000bb;">getSize</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getShowContainer</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">div </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"pager"</span><span style="color: #007700;">&gt;  &lt;!-- </span><span style="color: #0000bb;">this is the container </span><span style="color: #007700;">--&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif; </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getShowAmounts</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">p </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"amount"</span><span style="color: #007700;">&gt;  &lt;!-- </span><span style="color: #0000bb;">this is the show amounts</span><span style="color: #007700;">--&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getLastPageNum</span><span style="color: #007700;">()&gt;</span><span style="color: #0000bb;">1</span><span style="color: #007700;">): </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">__</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'Items %s to %s of %s total'</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getFirstNum</span><span style="color: #007700;">(), </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getLastNum</span><span style="color: #007700;">(), </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getTotalNum</span><span style="color: #007700;">()) </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">else: </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">__</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'%s Item(s)'</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getTotalNum</span><span style="color: #007700;">()) </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">endif; </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">p</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif; </span><span style="color: #0000bb;">?&gt;</p>
<p>&lt;?php</p>
<p></span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getShowPerPage</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">fieldset </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"limiter"</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">label</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">__</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'Show'</span><span style="color: #007700;">) </span><span style="color: #0000bb;">?&gt;</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">label</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">select onchange</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"setLocation(this.value)"</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">foreach (</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getAvailableLimit</span><span style="color: #007700;">() as </span><span style="color: #0000bb;">$_key</span><span style="color: #007700;">=&gt;</span><span style="color: #0000bb;">$_limit</span><span style="color: #007700;">): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">option value</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;getLimitUrl($_key) ?&gt;"</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">isLimitCurrent</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$_key</span><span style="color: #007700;">)): </span><span style="color: #0000bb;">?&gt; selected</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"selected"</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif </span><span style="color: #0000bb;">?&gt;</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$_limit ?&gt;<br />
</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">option</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endforeach; </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">select</span><span style="color: #007700;">&gt; </span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">__</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'per page'</span><span style="color: #007700;">) </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">fieldset</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif </span><span style="color: #0000bb;">?&gt;</p>
<p>&lt;?php</p>
<p></span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getLastPageNum</span><span style="color: #007700;">()&gt;</span><span style="color: #0000bb;">1</span><span style="color: #007700;">): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">div </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"pages"</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">strong</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">__</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'Page:'</span><span style="color: #007700;">) </span><span style="color: #0000bb;">?&gt;</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">strong</span><span style="color: #007700;">&gt;<br />
&lt;</span><span style="color: #0000bb;">ol</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">if (!</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">isFirstPage</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">a href</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;getPreviousPageUrl() ?&gt;"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">img src</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;getSkinUrl('images/back.png') ?&gt;" </span><span style="color: #0000bb;">alt</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;__('Previous Page') ?&gt;" </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"v-middle" </span><span style="color: #007700;">/&gt;&lt;/</span><span style="color: #0000bb;">a</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">foreach (</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getPages</span><span style="color: #007700;">() as </span><span style="color: #0000bb;">$_page</span><span style="color: #007700;">): </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">if (</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">isPageCurrent</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$_page</span><span style="color: #007700;">)): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">span </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"current"</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$_page ?&gt;</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">span</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">else: </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">a href</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;getPageUrl($_page) ?&gt;"</span><span style="color: #007700;">&gt;</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">echo </span><span style="color: #0000bb;">$_page ?&gt;</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">a</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">endforeach;; </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">if (!</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">isLastPage</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">a href</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;getNextPageUrl() ?&gt;"</span><span style="color: #007700;">&gt;&lt;</span><span style="color: #0000bb;">img src</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;getSkinUrl('images/next.png') ?&gt;" </span><span style="color: #0000bb;">alt</span><span style="color: #007700;">=</span><span style="color: #dd0000;">"&lt;?php echo $this-&gt;__('Next Page') ?&gt;" </span><span style="color: #007700;">class=</span><span style="color: #dd0000;">"v-middle" </span><span style="color: #007700;">/&gt;&lt;/</span><span style="color: #0000bb;">a</span><span style="color: #007700;">&gt;&lt;/</span><span style="color: #0000bb;">li</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">ol</span><span style="color: #007700;">&gt;<br />
&lt;/</span><span style="color: #0000bb;">div</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif; </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">if(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getShowContainer</span><span style="color: #007700;">()): </span><span style="color: #0000bb;">?&gt;<br />
</span><span style="color: #007700;">&lt;/</span><span style="color: #0000bb;">div</span><span style="color: #007700;">&gt;<br />
</span><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">endif; </span><span style="color: #0000bb;">?&gt;<br />
&lt;?php </span><span style="color: #007700;">endif; </span><span style="color: #0000bb;">?&gt;</span></code></div>
</div>
</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/magento-paggination-problem-in-magento-1-4-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Promotion &amp; Random Products in Magento</title>
		<link>http://www.phpasks.com/blogs/2010/05/display-promotion-random-products-in-magento/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/display-promotion-random-products-in-magento/#comments</comments>
		<pubDate>Wed, 26 May 2010 06:43:25 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>
		<category><![CDATA[Magneto Promotion Products]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1275</guid>
		<description><![CDATA[There are two unused product list blocks in Magento which can be very useful if you push a few buttons, edit few layouts .. 1. Promotion Block located in app\code\core\Mage\Catalog\Block\Product\List\Promotion.php This is basically built in featured product functionality. It reacts to “promotion” attribute which needs to be created, so let’s click Catalog-&#62;Attributes-&#62;Manage Attributes-&#62;Create New Attribute ]]></description>
			<content:encoded><![CDATA[<p>There are two unused product list blocks in Magento which can be very useful if you push a few buttons, edit few layouts ..</p>
<p><span id="more-2785"> </span></p>
<p><strong>1. Promotion</strong><br />
Block located in app\code\core\Mage\Catalog\Block\Product\List\Promotion.php</p>
<p>This is basically built in featured product functionality. It reacts to “promotion” attribute which needs to be created, so let’s click<br />
Catalog-&gt;Attributes-&gt;Manage Attributes-&gt;Create New Attribute</p>
<p>Attribute Code: promotion<br />
Scope: Global<br />
Catalog Input Type for Store Owner: Yes/No</p>
<div id="attachment_1276" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1276" title="Promotion &amp; Random" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/05/promotion-and-random-1-300x254.jpg" alt="Promotion Products" width="300" height="254" /><p class="wp-caption-text">Promotion Products</p></div>
<p>Label: Promotion  (second tab)</p>
<p>Other params can be left alone, but it’s up to you of course. I also labeled it Promotion just for this article.</p>
<p>Now we need to add created attribute to attribute set, so navigate to<br />
Catalog-&gt;Attributes-&gt;Manage Attribute Sets<br />
select attribute set you’re using and drag promotion to General group for example.</p>
<p><img class="aligncenter size-full wp-image-1277" title="Promotion" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/05/promotion-and-random-2.jpg" alt="Promotion" width="471" height="399" /></p>
<p>Now when you’re editing your products, there is new “Promotion” option under General tab.</p>
<p><img class="aligncenter size-full wp-image-1278" title="promotion-and-random-3" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/05/promotion-and-random-3.jpg" alt="promotion-and-random-3" width="471" height="399" /></p>
<p>Products on which you select Yes will be shown on promotion block which can be displayed through layouts with</p>
<p>&lt;block type=&#8221;catalog/product_list_promotion&#8221; name=&#8221;product_promotion&#8221; template=&#8221;catalog/product/list.phtml&#8221;/&gt;</p>
<p>or as cms content with</p>
<p>{{block type=&#8217;catalog/product_list_promotion&#8217; template=&#8217;catalog/product/list.phtml&#8217;}}</p>
<p>This attribute should really be included in default attribute set or in Magento sample data.</p>
<p><strong>2. Random</strong><br />
Block located in app\code\core\Mage\Catalog\Block\Product\List\Random.php</p>
<p>This block loads random product collection from current store.</p>
<p>The fastest way to display it would also be something like</p>
<p>&lt;block type=&#8221;catalog/product_list_random&#8221; name=&#8221;product_random&#8221; template=&#8221;catalog/product/list.phtml&#8221;/&gt;</p>
<p>since it also extends product_list block, however, since it is random product listing, that toolbar has no purpose here, so create phtml that will suit your shop needs, based on catalog/product/list.phtml. For example, i’m using similar Random block to display random products in sidebar.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/display-promotion-random-products-in-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Import Products into Magento</title>
		<link>http://www.phpasks.com/blogs/2010/05/how-to-import-products-into-magento/</link>
		<comments>http://www.phpasks.com/blogs/2010/05/how-to-import-products-into-magento/#comments</comments>
		<pubDate>Wed, 26 May 2010 05:24:12 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Magento Developer]]></category>
		<category><![CDATA[Magento Development]]></category>
		<category><![CDATA[Mambo Developer]]></category>
		<category><![CDATA[Import Products into Magento]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1272</guid>
		<description><![CDATA[There’s a little confusion among some on how to import products into a Magento ecommerce store. I spent some time today researching and trying to find the best method on doing this. The reason for my research is because there was no simple documentation anywhere that I could find on how to import products. Magento ]]></description>
			<content:encoded><![CDATA[<p>There’s a little confusion among some on how to <strong>import products into a Magento ecommerce store</strong>. I spent some time today researching and trying to find the best method on doing this. The reason for my research is because there was no simple documentation anywhere that I could find on how to import products. Magento actually has built a pretty robust import/export mechanism into the ecommerce cms that has a ton of flexibility to do many things. I’m not going to cover all of those. This is just for those of you who simply just want to import products into their Magento cart.</p>
<p><span style="text-decoration: underline;"><strong>Step 1 – Add a new product manually</strong></span><br />
add a new product manually to the catalog, assign it to a category, and fill out all fields that will be necessary to your store. The obvious ones are price, description, quantity etc. It’s important that you fill out all fields that you know you are going to need for all the products you import.</p>
<p><span style="text-decoration: underline;"><strong>Step 2 – Export Your Products</strong></span><br />
Now we want to export your product to a .csv file so that we can view the fields that are required to import. Go to System &gt;&gt; Import/Export &gt;&gt; Profiles. Now click on Export All Products then Run Profile. Click on the “Run Profile in Popup” button. Once the export is completed, go to your var/export directory on your Magento install and you will find the .csv file there for you to download.</p>
<p><span style="text-decoration: underline;"><strong>Step 3 – Analyze The .CSV File</strong></span><br />
Now if you look at your .csv export file you will see the field names that you need to match up. Now just start filling yours in and creating your csv file ready for import. This step is extremely important. Otherwise Magento cannot match what you are trying to import and the importing will fail. At a most basic level, here are the fields that I imported:</p>
<ul>
<li>store</li>
<li>attribute_set</li>
<li>type</li>
<li>sku</li>
<li>category_ids</li>
<li>status</li>
<li>visibility</li>
<li>tax_class_id</li>
<li>weight</li>
<li>price</li>
<li>name</li>
<li>description</li>
</ul>
<p><span style="text-decoration: underline;"><strong>Step 4 – Import Your New .CSV File</strong></span><br />
Now go to System &gt;&gt; Import/Export &gt;&gt; Profiles. Now click on Import All Products. Change “Type” under Data Format to CSV/Tab Seperated. Now click on Upload File, and browse for your .csv file and click “Save and Continue Editing”. Now go to “Run Profile” and select your file from the dropdown menu. Click the button underneath to run the import. And whalllah. All your products should now be imported.</p>
<p>That was the easiest most simple approach that I could find for Importing Products into a Magento Open Source Ecommerce Store. Like I said I tried this myself and it worked well for me. After that, I went in and manually updated all of my Images and<br />
Quantity numbers. You could even import those if you want to. But for<br />
my purpose I didn’t need to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/05/how-to-import-products-into-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Dev The &#8220;Hello World!&#8221; app</title>
		<link>http://www.phpasks.com/blogs/2010/04/iphone-dev-the-hello-world-app/</link>
		<comments>http://www.phpasks.com/blogs/2010/04/iphone-dev-the-hello-world-app/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 04:58:30 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1267</guid>
		<description><![CDATA[In the last iPhone Dev 101 post, I told you a little about creating your first project using Xcode; however, in this post, I want to show you how to create your first application that will run in the iPhone simulator. In honor of staying with the classic way of teaching programming, we&#8217;ll create a ]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.tuaw.com/2009/03/31/iphone-dev-101-creating-xcode-projects-brief-xcode-ui-overview/">last iPhone Dev 101 post</a>, I told you a little about creating your first project using Xcode; however, in this post, I want to show you how to create your first application that will run in the iPhone simulator. In honor of staying with the classic way of teaching programming, we&#8217;ll create a &#8220;<a href="http://en.wikipedia.org/wiki/Hello_world_program">Hello World!</a>&#8221; application as our first one.</p>
<p><strong>Creating the new project</strong><br />
If you have installed the iPhone SDK/Xcode, then you can launch Xcode by navigating to /Developer/Applications. Once there, you can double click on the Xcode application (you may also find it handy to just drag the icon to the dock if you will be using it a lot).</p>
<p>Once Xcode launches, click File &gt; New Project. Under the iPhone OS section on the left side of the resulting window, select &#8220;Application.&#8221; Select &#8220;View-based Application&#8221; from the templates that show up on the right side, and then click the &#8220;Choose&#8221; button. You will then be prompted to specify a project save name &#8212; this will also be the name of your resulting application, so choose your project name wisely.</p>
<p>You&#8217;re project has now been created, and the Xcode window that is displayed will contain all of your code, resources, etc. There isn&#8217;t much there now, but the application is fully functional at this point. You can click the &#8220;Build &amp; Go&#8221; button in the toolbar, and the application will be compiled and launched in the iPhone Simulator. Again, this is a fully functional application, but it doesn&#8217;t do anything useful at this point &#8212; the usefulness of the app is up to your coding, but Apple supplies you with the base code and dependencies.</p>
<div id="continued"><strong>Using .xib files</strong><br />
XIB files are a &#8220;newer&#8221; format of Apple&#8217;s older NIB files. These files are where the user interface behind the Mac &amp; iPhone applications is saved/packaged. The history of the NIB file is quite interesting and stretches back to the days of <a href="http://www.tuaw.com/tag/NeXT/">NeXT</a> (you can read more about the <a href="http://en.wikipedia.org/wiki/Interface_Builder">history of Interface Builder here</a>). You edit the user interface in an application called Interface Builder, which saves to these file types. When you double click on one of the files in Xcode, Interface Builder (IB) will automatically launch. Let&#8217;s double click on the MainWindow.xib file.</p>
<p>Once it loads, IB will display a mockup of an iPhone OS view. This view can have objects (buttons, text, etc.) placed on it, and linked to in the code. For this project, however, let&#8217;s make sure the Library window is open: Click Tools &gt; Library (or press shift + command + L). In the Library, you will find all of the components that can make up <img id="vimage_3" src="http://www.blogcdn.com/www.tuaw.com/media/2009/04/iphone-101_-the-_hello-world%21_-app_editingtext.jpg" border="0" alt="" hspace="8" vspace="8" width="225" height="83" align="right" />an iPhone application. In the Library window, select &#8220;Objects,&#8221; and then click Library; In the search box type &#8220;text.&#8221; The search results will return two objects, but the one we want is the &#8220;Text View,&#8221; so drag that to the &#8220;Hello World View Controller&#8221; window, and the object will be &#8220;created.&#8221; If you double click where you just dragged the text view, then you will be able to edit the text that will be shown when the app launches. You can type what ever you wish, but we&#8217;ll use &#8220;Hello World!&#8221;</p>
<p>Once you have your text typed, select File &gt; Save, from within IB; the information will be saved in the .xib file. Now close IB &#8212; you should see the Xcode application still opened.</p>
<p><strong>Running your &#8220;Hello World!&#8221; iPhone app</strong><br />
Select &#8220;Build and Go&#8221; from the toolbar in Xcode. It will save the current project, compile the source code (along with the .xib file), and run it inside of the iPhone simulator. If you get an error while compiling, make sure that the build settings are set to &#8220;Simulator &#8211; iPhone OS 2.2.1.&#8221; You change this by clicking on the Overview drop-down menu on the tool bar; You can also change this by going to the Project &gt; Set Active SDK menu.</p>
<div style="text-align: center;"><img id="vimage_2" src="http://www.blogcdn.com/www.tuaw.com/media/2009/04/iphone-101_-the-_hello-world%21_-app_xcode.jpg" border="1" alt="" hspace="8" vspace="8" width="425" height="309" /></div>
<p>Your application should launch in the simulator and display the text &#8220;Hello World!&#8221; So, congrats on your first iPhone application! Now you&#8217;re ready to start writing much cooler apps that take full advantage of the iPhone. If you don&#8217;t have Objective-C (or Cocoa) knowledge, I recommend that you <a href="http://www.tuaw.com/2009/03/25/iphone-dev-101-useful-cocoa-development-resources/">backtrack to the post about useful Cocoa resources</a>.</p>
<p>In the next iPhone Dev 101 post, I&#8217;ll talk about taking testing one step further by creating an Ad-hoc copy of your applications.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/04/iphone-dev-the-hello-world-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First iPhone Application</title>
		<link>http://www.phpasks.com/blogs/2010/04/first-iphone-application/</link>
		<comments>http://www.phpasks.com/blogs/2010/04/first-iphone-application/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 05:21:03 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1256</guid>
		<description><![CDATA[Introduction In this tutorial I will give you a brief introduction on how to get started with your first iPhone application. To begin you will need the latest version of the iPhone SDK which you can download it from here. With the SDK you get some tools like Xcode, Interface Builder, iPhone simulator, and many ]]></description>
			<content:encoded><![CDATA[<p><span><span style="font-weight: bold; color: #000000; font-size: 130%;">Introduction</span><br />
In this tutorial I will give you a brief introduction on how to get started with your first iPhone application. To begin you will need the latest version of the iPhone SDK which you can download it from here. With the SDK you get some tools like Xcode, Interface Builder, iPhone simulator, and many more. The first application is usually called &#8220;Hello World&#8221; but I have named my first app &#8220;Hello Universe&#8221; because a revolutionary device calls for a change of name.</span></p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Purpose of the &#8220;Hello Universe&#8221; app</span></span><br />
Using the app a user will be able to enter his/her full name and click a button to see a message appear. The message will say &#8220;John Doe says Hello Universe!!!&#8221;. This app will not only introduce you to some of the tools but will also show you how to use controls, respond to events and create new views. Excited, I am <img src='http://www.phpasks.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>This is how the app will look like<br />
<img class="aligncenter size-medium wp-image-1263" title="FinalApp" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/FinalApp-155x300.jpg" alt="FinalApp" width="155" height="300" /><br />
<span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Creating a new project</span></span><br />
Launch Xcode and click on File -&gt; New Project -&gt; Select Application (under iPhone OS) -&gt; select Window-Based Application project template and click on choose.<br />
<img class="aligncenter size-medium wp-image-1262" title="NewProjectWindow" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/NewProjectWindow-300x221.jpg" alt="NewProjectWindow" width="300" height="221" /><br />
In the next screen you will be asked to save your project and give it a name. Xcode creates some files for us based on the name of the project, so you want to be careful with the name you provide. I have named my project &#8220;HelloUniverse&#8221;.</p>
<p>This is how the list of files look like in Xcode.<br />
<img class="aligncenter size-medium wp-image-1265" title="Files" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/Files-230x300.jpg" alt="Files" width="230" height="300" /><br />
All the class files are stored under the &#8220;Classes&#8221; folder, some special files are listed under &#8220;Other Sources&#8221;, all the view files and resources show up under &#8220;Resources&#8221;, and any library or frameworks we add to our project are listed under the &#8220;Frameworks&#8221; folder. It is important that we save all the images, files, databases, and views in the &#8220;Resources&#8221; folder because all the iPhone apps run in its own sand box; which means they can only access files placed under the resources folder.</p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">How the app is launched</span></span><br />
Every C/C++/Java/C# programmer knows about the main method found in main.m file which is present under the &#8220;Other Sources&#8221; folder. You normally will never have to change this method and all we have to know is that this method is responsible in launching the app. The method applicationDidFinishLaunching method is called when the app is launched on the device or the simulator. The method is defined in &#8220;HelloUniverseAppDelegate.m&#8221; file which is found under the &#8220;Classes&#8221; folder.</p>
<p><span style="font-weight: bold; color: #000000; font-size: 130%;">Interface Builder</span><br />
Using Interface Builder we can design our application by adding controls or creating additional views. The files that the Interface Builder creates gets saved with a .xib extension and are called nib files. Every project gets one nib file by called which is called &#8220;MainWindow.xib&#8221; which can be found under &#8220;Resources&#8221;. An iPhone application has only one window (MainWindow.xib) unlike a desktop application which is created with multiple windows; however, we can create multiple views which are added to the window. Double click on &#8220;MainWindow.xib&#8221; to launch the Interface Builder, which will open four windows and one of the window will look like this</p>
<p><img class="aligncenter size-medium wp-image-1261" title="MainWindow" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/MainWindow-300x234.jpg" alt="MainWindow" width="300" height="234" /><br />
The above picture shows the contents of the &#8220;MainWindow.xib&#8221; nib file. Every nib file has atleast two files; File&#8217;s Owner and First Responder which cannot be deleted. Every other objects apart from the first two, represents an instance of an object which gets created when the nib file loads. File&#8217;s Owner simply shows that it owns the object in the nib file. First Responder tells us which object are we currently interacting with; like the textbox, buttons&#8230; The third object which is special to the MainWindow.xib file is called &#8220;Hello Universe App Delegate&#8221; and this file represents &#8220;HelloUniverseAppDelegate&#8221; class. Last but not the least the view represents the object which we design in our apps.</p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Creating a new view</span></span><br />
If we had created this project using &#8220;View-Based Application&#8221; project template then there would have been no need of creating another view from scratch, but where is the fun in that. In Interface Builder create a new view by clicking File -&gt; New -&gt; Select Cocoa Touch -&gt; View and click on choose. Let&#8217;s save the view in the project folder by naming it &#8220;HelloUniverse&#8221; and once we do that IB (Interface Builder) will prompt us to add the view to the current project; click on &#8220;Add&#8221; and it will show up in Xcode. In Xcode and move your view to the Resources folder.</p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Creating a view controller</span></span><br />
We have a view now let&#8217;s create a view controller to manage the view. In Xcode create a new view controller by selecting classes and clicking File -&gt; New File -&gt; Select Cocoa Touch Classes under iPhone OS -&gt; select UIViewController -&gt; click on choose and name your file &#8220;HelloUniverseController&#8221; without changing the extension. The newly created class inherits from UIViewController which knows how to interact with a view. Now that we have our view and the controller class, there must be some way to connect these two files and we can do it by setting the class property of the File&#8217;s Owner. Double click &#8220;HelloUniverse.xib&#8221; file in Xcode to launch Interface Builder and select File&#8217;s Owner -&gt; select Tools -&gt; Identity Inspector and under &#8220;Class Identity&#8221; category, change the class to &#8220;HelloUniverseController&#8221;. This is how the Class Identity should look like</p>
<p><img class="aligncenter size-full wp-image-1259" title="ClassIdentity" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/ClassIdentity.jpg" alt="ClassIdentity" width="286" height="112" /><br />
Once that is done we need a way to control the view in the nib file from code and this is done by connecting the view instance variable to the view object in the nib. The connection is made using &#8220;outlets&#8221;. Select Tools -&gt; Connections Inspector create a connection from the view variable to the view in the nib file. Move your mouse over the empty circle to see it change to a plus symbol indicating that a connection can be created. Click on circle and drag your mouse to the view in the nib file and release. As you do this you will see a blue line being created from the circle to the mouse. Once a connection is created, the connections inspector for File&#8217;s Owner will look like this</p>
<p><img class="aligncenter size-full wp-image-1260" title="Connections" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/Connections.jpg" alt="Connections" width="283" height="157" /><br />
<span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Adding controls to the view</span></span><br />
From the screen shot above we require two text boxes, one label, and a button (Round Rect Button). From the library drag and drop the controls to the view and align it as seen in the figure 1.0. After you have added the controls let&#8217;s change some of its properties, starting with the text boxes. Select the first text box and open Attributes Inspector by selecting Tools -&gt; Attributes Inspector. Under Placeholder enter &#8220;First name&#8221;, under &#8220;Text Input Traits&#8221; change Capitalize property to &#8220;Words&#8221; and change the Return key property to &#8220;Done&#8221;. Apply the same settings for the other text box but change the Placeholder to say &#8220;Last name&#8221;. Select the label and delete its text property, since we do not want the label to say anything until the button is clicked. Double-click the button to edit the title of the button and type in &#8220;Click Me&#8221;. Save and quit Interface Builder as we have successfully designed our view.</p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Connecting instance variables to the objects in the view</span></span><br />
We still need some way to interact with the controls on the view, in code and this is where outlets help us out. IBOutlet is a special keyword if used with an instance variable, will make the variable appear in Interface Builder. Since IBOutlet makes the variable appear in Interface Builder, using IBAction as a return type for a method will have the opposite effect. Using IBAction we can handle an event triggered by any control placed on the view. Let&#8217;s see how this works; open HelloUniverseController.h file in Xcode and type in the following code</p>
<div>
<div><code>//HelloUniverseController.h<br />
@interface HelloUniverseController : UIViewController {</code></p>
<p>IBOutlet UITextField *txtFirstName;<br />
IBOutlet UITextField *txtLastName;<br />
IBOutlet UILabel *lblMessage;<br />
}</p>
<p>- (IBAction) btnClickMe_Clicked:(id)sender;</p>
<p>@end</p>
<p>//HelloUniverseController.m<br />
- (void)dealloc {<br />
[txtFirstName release];<br />
[txtLastName release];<br />
[lblMessage release];<br />
[super dealloc];<br />
}</p></div>
</div>
<p>All the variables above are marked with IBOutlet and Interface Builder will make these available to itself so proper connections can be made. We also have a method whose return type is IBAction (void); Interface Builder will also make this method available to itself so we can choose which event will call this method. The method also takes a parameter called &#8220;sender&#8221; which is the object which triggered the event. The variables are released in the dealloc method as shown above. Let&#8217;s connect these instance variables to the controls on the view (HelloUniverse) as described earlier. Open Interface Builder by double-clicking HelloUniverse.xib file and select File&#8217;s Owner, open Connections Inspector to see all the variables present under Outlets and to create connections.</p>
<p><img class="aligncenter size-full wp-image-1260" title="Connections" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/04/Connections.jpg" alt="Connections" width="283" height="157" /><br />
Let&#8217;s hook up the button click event to the &#8220;btnClickMe_Clicked&#8221; method. Select the button and under the Events list it seems that we do not have a button click event; however, we do have a &#8220;Touch Up Inside&#8221; event which is raised when the button is touched and released symbolizing a click. With the button selected click the circle next to &#8220;Touch Up Inside&#8221; and drag your mouse over to File&#8217;s Owner and release to have the method name show; simply click on the method name to create a connection.</p>
<p><img id="BLOGGER_PHOTO_ID_5303977413041756882" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 101px;" src="http://1.bp.blogspot.com/_ixq8Dp4ESMo/SZuDWwEMmtI/AAAAAAAAAGo/01lAJvpLCHM/s320/Screen.jpg" border="0" alt="" /><br />
<span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Handling events</span></span><br />
Let&#8217;s write some code in btnClickMe_Clicked event to read the first and last name and display a message in the label. This is how the code looks like</p>
<div>
<div><code>//HelloUniverseController.m<br />
- (IBAction) btnClickMe_Clicked:(id)sender {</code></p>
<p>NSString *FirstName = txtFirstName.text;<br />
NSString *LastName = txtLastName.text;<br />
NSString *Message = nil;</p>
<p>if([FirstName length] == 0 &amp;&amp; [LastName length] == 0)<br />
Message = [[NSString alloc] initWithFormat:@&#8221;Anonymous says Hello Universe!!!&#8221;];<br />
else if ([FirstName length] &gt; 0 &amp;&amp; [LastName length] ==0)<br />
Message = [[NSString alloc] initWithFormat:@&#8221;%@ says Hello Universe&#8221;, FirstName];<br />
else if ([FirstName length] == 0 &amp;&amp; [LastName length] == 0)<br />
Message = [[NSString alloc] initWithFormat:@&#8221;%@ says Hello Universe&#8221;, LastName];<br />
else<br />
Message = [[NSString alloc] initWithFormat:@&#8221;%@ %@ says Hello Universe&#8221;, FirstName, LastName];</p>
<p>lblMessage.text = Message;</p>
<p>//Release the object<br />
[Message release];<br />
}</p></div>
</div>
<p>The method does few simple things, it finds out the first and last names and figures out what message to display in the label. We also create a temporary variable called &#8220;Message&#8221; to hold the message which will be displayed in the label. The variable is allocated and initialized by alloc and initWithFormat messages respectively. The variable is released in the end because when working with the iPhone we are responsible of cleaning up the memory. The easiest way to remember when to release objects is; if you create it then you own the object and hence you are responsible of releasing it.</p>
<p>If you click on Build and Go, the view will not be visible because we have not yet added it to the window. Let&#8217;s see how we can do that</p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Adding view to the window</span></span><br />
Now we cannot drag the view and add it to the window, so we need another way to add the view as a sub view to the window. We already know that &#8220;HelloUniverseController&#8221; is the view controller of the view &#8220;HelloUniverse&#8221; and &#8220;HelloUniverseAppDelegate&#8221; is the application delegate where the window is made visible in applicationDidFinishLaunching method. It is in that method we will add the view as a sub view to the window. Before we do that, the application delegate (HelloUniverseAppDelegate) needs to know about our view controller. Add the following lines to HelloUniverseAppDelegate.h file to change the file like this</p>
<div>
<div><code>//HelloUniverseAppDelegate.h<br />
@class HelloUniverseController;</code></p>
<p>@interface HelloUniverseAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {<br />
UIWindow *window;<br />
HelloUniverseController *hvController;<br />
}</p>
<p>@property (nonatomic, retain) IBOutlet UIWindow *window;<br />
@property (nonatomic, retain) HelloUniverseController *hvController;</p>
<p>@end</p></div>
</div>
<p>From the above code we first add a forward class declaration of &#8220;HelloUniverseController&#8221; because we do not want any circular dependency when we import the header file of &#8220;HelloUniverseController&#8221; in HelloUniverseAppDelegate.m. A variable and a property of type HelloUniverseController is also declared. The property as you can see is declared with a couple of attributes called &#8220;retain&#8221; and &#8220;nonatomic&#8221;. The retain attribute will increase the reference count of the instance variable by one and nonatomic is used because our program is not multi-threaded.</p>
<p>A lot of first time users miss to synthesize the property we declared, so let&#8217;s do that now at the top of the HelloUniverseAppDelegate.m file and the code looks like this</p>
<div>
<div><code><br />
//HelloUniverseAppDelegate.m<br />
@implementation HelloUniverseAppDelegate</code></p>
<p>@synthesize window, hvController;<br />
&#8230;</p></div>
</div>
<p>The view is added as a subview to the window in applicationDidFinishLaunching method and this is how the code looks like</p>
<div>
<div><code>//HelloUniverseAppDelegate.m<br />
- (void)applicationDidFinishLaunching:(UIApplication *)application {</code></p>
<p>HelloUniverseController *hvc = [[HelloUniverseController alloc]<br />
initWithNibName:@&#8221;HelloUniverse&#8221; bundle:[NSBundle mainBundle]];</p>
<p>self.hvController = hvc;</p>
<p>[hvc release];</p>
<p>[window addSubview:[self.hvController view]];</p>
<p>// Override point for customization after application launch<br />
[window makeKeyAndVisible];<br />
}</p></div>
</div>
<p>The second line shows that we imported the header file of &#8220;HelloUniverseController&#8221; and we also synthesized the property hvController. In the &#8220;olden&#8221; days in order to create a property we had to create getter and setter methods which would be something like getHVController and setHVController. The synthesize keyword automatically generates these methods for us. In applicationDidFinishLaunching method we allocate and initialize a temporary variable, assign it to our property, release it, and the view associated with the view controller is added as a sub view to the window. The key thing to remember here is that the view message is passed to the &#8220;hvController&#8221; which returns the view and is added as sub view to the window. A valid view is returned because we created a connection from the view instance variable to the view in the nib file. The property is finally released in the dealloc method as shown below</p>
<div>
<div><code>//HelloUniverseAppDelegate.m<br />
- (void)dealloc {<br />
[hvController release];<br />
[window release];<br />
[super dealloc];<br />
}</code></div>
</div>
<p>We have always allocated and initialized variables in one single line as seen below, this is usually the accepted way but the same code can be written in a different way as seen below</p>
<div>
<div><code>HelloUniverseController *hvc = [HelloUniverseController alloc];<br />
hvc = [hvc initWithNibName:@"HelloUniverse" bundle:[NSBundle mainBundle]];</code></div>
</div>
<p>Build and go to test your application.</p>
<p><span style="color: #000000; font-size: 130%;"><span style="font-weight: bold;">Hiding the keyboard</span></span><br />
Wait a minute clicking the &#8220;Done&#8221; button doesn&#8217;t do anything. Ideally we would like to hide the keyboard when the &#8220;Done&#8221; button is clicked no matter which text box we are currently editing. To hide the keyboard we need to do two things; set the delegate of the keyboard to File&#8217;s Owner and implement a method called textFieldShouldReturn in HelloUniverseController.m file. To set the delegate, open Interface Builder by double clicking HelloUniverse.xib, select the first text box and click on Tools -&gt; Connections Inspector. Click and drag your mouse by selecting the empty circle next to delegate under &#8220;Outlets&#8221; and release your mouse over to File&#8217;s Owner. Assign the delegate for the next text box in the same manner.</p>
<p>The method textFieldShouldReturn gets called when the &#8220;Done&#8221; button is clicked and this is how the code looks like</p>
<div>
<div><code>//HelloUniverseController.m<br />
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {</code></p>
<p>[theTextField resignFirstResponder];<br />
return YES;<br />
}</p></div>
</div>
<p>The method gets a parameter called sender, which is the object that triggered the event. We will use the same object to which we send the resignResponder message, which will hide the keyboard on the textbox. The boolean &#8220;Yes&#8221; is returned to tell the sender that the first responder is resigned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/04/first-iphone-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Development Process</title>
		<link>http://www.phpasks.com/blogs/2010/03/development-process/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/development-process/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 11:02:53 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1254</guid>
		<description><![CDATA[Design &#8211; Develop &#8211; Implement &#8211; Support PHPAsKS offers a full-service experience to clients and partners &#8211; that is PHPAsKS approach to software and application development. Here at PHPAsKS, we understand that an idea needs to be protected and its value kept intact. After all, what would we develop if there were no ideas! So ]]></description>
			<content:encoded><![CDATA[<p><strong>Design &#8211; Develop &#8211; Implement &#8211; Support</strong></p>
<p>PHPAsKS offers a full-service experience to clients and partners &#8211; that is PHPAsKS approach to software and application development.</p>
<p>Here at PHPAsKS, we understand that an idea needs to be protected and its value kept intact. After all, what would we develop if there were no ideas! So even before we talk to you about your requirements, we ensure that an NDA (Non-Disclosure Agreement) is put in place to protect your asset from day one.</p>
<p>Once your asset is secured, our experienced product managers will work with you first to identify the key goals and requirements of your app. These will be further developed into a &#8220;implementable&#8221; idea, taking into consideration your guidelines and key performance indicators.</p>
<p>The idea is then refined and prototyped to hand over to our designers &#8211; we ensure that any brand identity and values are retained throughout the design process, and your aesthetic requirements are met to the fullest extent.</p>
<p>Once the design is finalised, our team of programmers and technical experts take over and convert that prototype into a fully functioning application.</p>
<p>But we don&#8217;t just stop there. Once the product is tested, signed-off and deployed, we also provide you with statistical data and analytics on usage, downloads and other reporting. We think that the post-deployment process is as important as the creation of the app itself.</p>
<p>Whether it’s an &#8220;on the go&#8221; app, custom-designed for your business, or a &#8220;light-bulb moment&#8221; idea you’d like to market, we can develop, test, and deliver whatever you’ve got in mind.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/development-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone app development</title>
		<link>http://www.phpasks.com/blogs/2010/03/iphone-app-development/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/iphone-app-development/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 11:00:34 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1252</guid>
		<description><![CDATA[Looking for an iPhone developer to handle your application development? At PHPAsKS, our iPhone developers specialise in all aspects of the iPhone development platform, spanning all mobile versions and operating systems. Our iPhone development methodology and lifecycle processes are best suited to a quality driven approach, and all apps are optimised and tested before being ]]></description>
			<content:encoded><![CDATA[<p><strong>Looking for an iPhone developer to handle your application development?</strong></p>
<p>At PHPAsKS, our iPhone developers specialise in all aspects of the iPhone development platform, spanning all mobile versions and operating systems.</p>
<p>Our iPhone development methodology and lifecycle processes are best suited to a quality driven approach, and all apps are optimised and tested before being deployed.</p>
<p>The PHPAsKS team of iPhone developers have years of experience developing on the Mac OS X platform, and are now utilising their skills on high quality and interative iPhone development.</p>
<p>If you are looking to hire an iPhone developer (or team of developers) for your project, PHPASKS can handle the entire development lifecycle for you from concept to execution, delivery and support.</p>
<p><strong>Interested?<br />
</strong>Find out more about our iPhone development services using the details on the right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/iphone-app-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check and uncheck a checkbox with jQuery</title>
		<link>http://www.phpasks.com/blogs/2010/03/how-to-check-and-uncheck-a-checkbox-with-jquery/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/how-to-check-and-uncheck-a-checkbox-with-jquery/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 13:30:38 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Jquery]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1249</guid>
		<description><![CDATA[jQuery is a Javascript framework which can simplify coding Javascript for a website and removes a lot of cross browser compatibility issues. Yesterday I looked at how to get and set form element values with jQuery but didn&#8217;t deal with checkboxes. Today&#8217;s post looks at how to tell if an HTML form checkbox is checked ]]></description>
			<content:encoded><![CDATA[<p>jQuery is a Javascript framework which can simplify coding Javascript for a website and removes a lot of cross browser compatibility issues. Yesterday I looked at how to get and set form element values with jQuery but didn&#8217;t deal with checkboxes. Today&#8217;s post looks at how to tell if an HTML form checkbox is checked or not checked with jQuery and then how to change it to be un/checked.</p>
<p>Our example form looks like this:</p>
<pre>&lt;input type="checkbox" name="foo" value="bar" /&gt;
&lt;input type="button" onclick="show_checked()" value="Show" /&gt;
&lt;input type="button" onclick="set_checked(true)" value="On" /&gt;
&lt;input type="button" onclick="set_checked(false)" value="Off" /&gt;</pre>
<p>There&#8217;s checkbox with name &#8220;foo&#8221; and then three buttons. The first calls a functionto show us if the checkbox is checked or not, and the second two change it from being checked to not being checked.</p>
<p>There are several ways to get to work out if a checkbox is checked or not with jQuery, and here a couple of alternatives. Each will return true if it&#8217;s checked or false if it&#8217;s not.</p>
<pre>$('input[name=foo]').is(':checked')
$('input[name=foo]').attr('checked')</pre>
<p>We can change the status of the checkbox using the attr() function like so, to check the box:</p>
<pre>$('input[name=foo]').attr('checked', true);</pre>
<p>and like so to uncheck the box:</p>
<pre>$('input[name=foo]').attr('checked', false);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/how-to-check-and-uncheck-a-checkbox-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery get select option value</title>
		<link>http://www.phpasks.com/blogs/2010/03/jquery-get-select-option-value/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/jquery-get-select-option-value/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 13:26:20 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Jquery]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1245</guid>
		<description><![CDATA[Asif Khalyani asked me a simple question today, but it is worth noting because I have asked the same before, &#8220;How do you get the current value from a select list?&#8221; t&#8217;s looking for an element with id list which has a property value equal to 2. What you want is the option child of ]]></description>
			<content:encoded><![CDATA[<p><strong>Asif Khalyani</strong> asked me a simple question today, but it is worth noting because I have asked the same before, &#8220;How do you get the current value from a select list?&#8221;</p>
<p>t&#8217;s looking for an element with id list which has a property value equal to 2. What you want is the option child of the list.<br />
$(&#8220;#list option[value='2']&#8220;).text()</p>
<p>But sometimes you may need to get the selected option&#8217;s text. This is not as straight forward. First, we get the selected option with <code>:selected</code> selector. Then once we have the option, we can get the text with the function, <code>text()</code>.</p>
<div>
<pre><code><span>$</span><span>(</span><span>"#list option:selected"</span><span>).</span><span>text</span><span>();
</span></code>$j("#txt_employee_name option:selected").val() // Get the Option ID
</pre>
<pre>
<h2>Getting a form value with jQuery</h2>

To get a form value with jQuery use the val() function. Let's say we have a form like this, using an id for each form element:
<pre>&lt;input name="foo" id="foo" type="text"&gt;

&lt;select name="foo" id="bar"&gt;
    &lt;option value="1"&gt;one&lt;/option&gt;
    &lt;option value="2"&gt;two&lt;/option&gt;
    &lt;option value="3"&gt;three&lt;/option&gt;
&lt;/select&gt;</pre>
<p>We can display an alert for the values of "foo" and "bar" as easily this:</p>
<pre>window.alert( $('#foo').val() );
window.alert( $('#bar').val() );</pre>
<p>If we're using the name only and not specifying an id, the jQuery to get the form values would be this:</p>
<pre>window.alert( $('[name=foo]').val() );
window.alert( $('[name=bar]').val() );</pre>
<p>If you have a group of radio buttons and want to get the selected button, the code is slightly different because they all have the same name. Using the above code examples will show the value for the first radio button on the form with that name. To find out the value of the checked one, do this instead:<br />
HTML:</p>
<pre>&lt;input type="radio" name="baz" value="x"&gt;
&lt;input type="radio" name="baz" value="y"&gt;
&lt;input type="radio" name="baz" value="z"&gt;</pre>
<p>jQuery:</p>
<pre>window.alert($('input[name=baz]:checked').val());</pre>
<h2>Setting a form value with jQuery</h2>
<p>You can set the form values with jQuery using the same val() function but passing it a new value instead. Using the same example forms above, you'd do this for the text input and select box:</p>
<pre>$('#foo').val('this is some example text');
$('#bar').val('3');
OR
$('[name=foo]').val('this is some example text');
$('[name=bar]').val('3');</pre>
<p>Using the above for a radio button will change the actual value of the radio button rather than changing the one that is selected. To change the radio button that is selected you'd do this:</p>
<pre>$('input[name="baz"]')[0].checked = true;</pre>
<p>[0] would set the first one checked, [1] would set the second one checked and so on.</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/jquery-get-select-option-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Selext Box In jQuery</title>
		<link>http://www.phpasks.com/blogs/2010/03/create-selext-box-in-jquery/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/create-selext-box-in-jquery/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 13:15:38 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Jquery]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1243</guid>
		<description><![CDATA[In jQuery, working with select box required some additional knowledge and interaction with jQuery. You may have some problem manipulating select box during your web development on jQuery. In this article we will discuss how you can solve this without any additional plugin to kill efficiency. Create Selext Box In jQuery Create a select box ]]></description>
			<content:encoded><![CDATA[<p>In jQuery, working with select box required some additional knowledge and interaction with jQuery. You may have some problem manipulating select box during your web development on jQuery. In this article we will discuss how you can solve this without any additional plugin to kill efficiency.<br />
<br clear="all" /> </p>
<h2>Create Selext Box In jQuery</h2>
<p>Create a select box is very simple and straight forward. Just write a string with the normal select tag and a select box is created in jQuery</p>
<div id="highlighter_845654">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>jQuery(</code><code>'#some_element'</code><code>).append(</code><code>'&lt;select&gt;&lt;/select&gt;'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>I bet everyone would have tried this and it work. However, manipulating might be a more challenging task.</p>
<h2>Add Option In Select Box With jQuery</h2>
<p>One easy way is to create a string with the whole element and create it straight away</p>
<div id="highlighter_554803">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>01</code></td>
<td><code>//obj is the list of option values</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>02</code></td>
<td><code>function</code><code>(obj)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>03</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>04</code></td>
<td><code> </code><code>var</code> <code>create = </code><code>'&lt;select id="test"&gt;'</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>for</code><code>(</code><code>var</code> <code>i = 0; i &lt; obj.length;i++)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>06</code></td>
<td><code> </code><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>07</code></td>
<td><code> </code><code>create += </code><code>'&lt;option value="'</code><code>+obj[i]+</code><code>'"&gt;'</code><code>+obj[i]+</code><code>'&lt;/option&gt;'</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>08</code></td>
<td><code> </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>09</code></td>
<td><code> </code><code>create += </code><code>'&lt;/select&gt;'</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>10</code></td>
<td><code> </code><code>jQuery(</code><code>'#some_element'</code><code>).append(create);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>11</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Another way to create a list of elements is to create its option and append it in using pure jQuery.</p>
<div id="highlighter_401061">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>function</code><code>(id, obj)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>jQuery(</code><code>'#some_element'</code><code>).append(</code><code>'&lt;select id="'</code><code>+id+</code><code>'"&gt;&lt;/select&gt;'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>jQuery.each(obj, </code><code>function</code><code>(val, text) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>5</code></td>
<td><code> </code><code>jQuery(</code><code>'#'</code><code>+id).append(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>6</code></td>
<td><code> </code><code>jQuery(</code><code>'&lt;option&gt;&lt;/option'</code><code>).val(val).html(text)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>7</code></td>
<td><code> </code><code>);})</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>8</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>You may not be familiar what i wrote above. Hence, a more javascript approach is shown below.</p>
<div id="highlighter_780362">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>function</code><code>(id, obj)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>jQuery(</code><code>'#some_element'</code><code>).append(</code><code>'&lt;select id="'</code><code>+id+</code><code>'"&gt;&lt;/select&gt;'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>4</code></td>
<td><code> </code><code>for</code><code>(</code><code>var</code> <code>i = 0; i &lt; obj.length;i++)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>5</code></td>
<td><code> </code><code>{</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>6</code></td>
<td><code> </code><code>jQuery(</code><code>'#'</code><code>+id).append(</code><code>'&lt;option value="'</code><code>+obj[i]+</code><code>'"&gt;'</code><code>+obj[i]+</code><code>'&lt;/option'</code><code>)</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>7</code></td>
<td><code> </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>8</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h2>Get Select Box Value/Text In jQuery</h2>
<p>Sometimes we want to know what is the value of the selected option. This is how we do it.</p>
<div id="highlighter_453447">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>jQuery(</code><code>'#selectbox: selected'</code><code>).val();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>On the other hand, we can get the text of the option by doing this.</p>
<div id="highlighter_84065">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>jQuery(</code><code>'#selectbox: selected'</code><code>).text();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>What if you know the value of the options you want to get instead of the one selected?</p>
<div id="highlighter_322461">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$(</code><code>"#selectList option[value='thisistheone']"</code><code>).text();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>How about the first element on the select box?</p>
<div id="highlighter_668831">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$(</code><code>"#selectList option:first"</code><code>).text()</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>How about the n element on the select box?</p>
<div id="highlighter_629912">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$(</code><code>"#selectList option:eq(3)"</code><code>).text()</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>How about getting all elements but the first and last one in a select box?</p>
<div id="highlighter_570195">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$(</code><code>"#selectList option:not(option:first, option:last)"</code><code>).each(</code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>3</code></td>
<td><code>$(this).text();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>4</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h2>Get Multiple Selected Value/Text In jQuery Select Box</h2>
<p>Now we want to try to retrieve multiple selected values, we can do it easily with the following code.</p>
<div id="highlighter_458962">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>jQuery(</code><code>'#some_element:selected'</code><code>).each(</code><code>function</code><code>(){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code> </code><code>alert(jQuery(this).text());</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>alert(jQuery(this).val());</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>4</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>How about storing these values?</p>
<div id="highlighter_216154">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>var</code> <code>current = [];</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>jQuery(</code><code>'#some_element:selected'</code><code>).each(</code><code>function</code><code>(index, selectedObj){</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>3</code></td>
<td><code> </code><code>current[index] = $(selectedObj).text();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>4</code></td>
<td><code>});</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>This way we eliminate the additional index needed to follow through the loop! How about shorten the cold a bit?</p>
<div id="highlighter_596299">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>var</code> <code>foo = jQuery(</code><code>'#multiple :selected'</code><code>).map(</code><code>function</code><code>(){</code><code>return</code> <code>jQuery(this).val();}).get();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>This way we eliminate the need to create an array.</p>
<h2>Remove Element In Select Box With jQuery</h2>
<p>So we can get and add element into the select box. How about remove them? Basically, you will need to use one of the get element method describe above before applying the remove instruction.</p>
<div id="highlighter_864279">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>jQuery(</code><code>'#selectbox: selected'</code><code>).remove();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Here we will remove all elements except the first and last one.</p>
<div id="highlighter_158229">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>//#selectbox is the id of the select box</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$(</code><code>"#selectbox option:not(option:first, option:last)"</code><code>).remove();</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<h2>Select an option in the select box  with jQuery</h2>
<p>If you want to select an option in the select box, you can do this.</p>
<div id="highlighter_413039">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>jQuery(</code><code>'#selectbox option'</code><code>).attr(</code><code>'selected'</code><code>, </code><code>'selected'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>all option will be selected in this case.</p>
<h2>UnSelect an option in the select box with jQuery</h2>
<p>If you want to unselect an option in the select box, you can do this.</p>
<div id="highlighter_440446">
<div>
<div>
<table border="0">
<tbody>
<tr>
<td><code>1</code></td>
<td><code>jQuery(</code><code>'#selectbox option'</code><code>).attr(</code><code>'selected'</code><code>, false);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>all option will be unselected n this case.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/create-selext-box-in-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best methods to optimize JPEG images for websites</title>
		<link>http://www.phpasks.com/blogs/2010/03/best-methods-to-optimize-jpeg-images-for-websites/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/best-methods-to-optimize-jpeg-images-for-websites/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:43:18 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1240</guid>
		<description><![CDATA[Best methods to optimize JPEG images for websites While Internet connections becoming faster and faster, it’s still important to keep your website as fast as possible. One of the “slow” parts of your website are the images. In this article we show several ways to down-size the JPEG images for your website. If you design ]]></description>
			<content:encoded><![CDATA[<p><!--header.php end--> <!--single.php--> <!--loop--> <!--post title--></p>
<h1 id="post-964"><a title="Permanent Link: Best methods to optimize JPEG images for websites" rel="bookmark" href="http://www.web-development-blog.com/archives/best-methods-to-optimize-jpeg-images-for-websites/">Best methods to optimize JPEG images for websites</a></h1>
<p><!--Post Meta-->While Internet connections becoming faster and faster, it’s still important to keep your website as fast as possible. One of the “slow” parts of your website are the images. In this article we show several ways to down-size the JPEG images for your website.</p>
<p>If you design your website should use some compression for your photos, banners and many other web elements. You favorite image editor should have some function to down-size your images. For this article we compare 4 ways to compress our example photo (file-size 393KB):</p>
<h3>Adobe Photoshop</h3>
<p>If you use the “Save for web…” function it’s possible to create a web optimized version from your image that is small enough and has a quality which is good enough for the Internet. In our example we used the preset “High Quality” which is equal to 60% quality. The result is a smaller file with a file-size of 95KB.</p>
<p><!-- Quick Adsense WordPress Plugin: http://techmilieu.com/quick-adsense --></p>
<h3>Adobe Fireworks</h3>
<p>Fireworks is my favorite web image editor because of the unique feature to have bitmap and vector elements in a single file. We did an export with 80% quality and the compressed version has a file-size of 85KB.<br />
<span id="more-964"> </span></p>
<h3>GIMP (free Image Editor)</h3>
<p>Both Adobe products are not free and are only available for Wndows or Mac. If you need a free editor you should try Gimp, an Image editor which many functions like the other commercial products mentioned before. The editor has also a “Safe for web” function and we used and 86% quality for our export file which becomes a size of 87KB. If you use GIMP to down-size your photos from your digital camera you should check the option “Strip EXIF”, removing the photo’s meta data will make the file smaller for another ~10KB.</p>
<h3><a href="http://www.web-development-blog.com/archives/image-manipulations-with-imagemagick/">ImageMagick</a> (command line tools)</h3>
<p>The last option is a tool we used via the command line. Using the following command the file is down-sized using an 80% quality (file size after conversion is 89KB):</p>
<p><code>convert original_100.jpg -quality 80 imagemagick_80.jpg</code></p>
<p>Sure this method works different from the other methods but the good point is that you can use this code in your PHP scripts or just from the command line of your web server.</p>
<h3>Original image and compressed copies</h3>
<p>Check the images below and note that the quality for the compressed images (file 2-5) is very similar.</p>
<div>
<dl style="width: 33%;">
<dt> <a title="Original 100%" rel="shadowbox[post-964];player=img;" href="http://www.web-development-blog.com/wp-content/uploads/2010/03/original_100.jpg"><img title="Original 100%" src="http://www.web-development-blog.com/wp-content/uploads/2010/03/original_100-150x150.jpg" alt="Original 100%" width="150" height="150" /></a> </dt>
</dl>
<dl style="width: 33%;">
<dt> <a title="Adobe Photoshop 60%" rel="shadowbox[post-964];player=img;" href="http://www.web-development-blog.com/wp-content/uploads/2010/03/photoshop_60.jpg"><img title="Adobe Photoshop 60%" src="http://www.web-development-blog.com/wp-content/uploads/2010/03/photoshop_60-150x150.jpg" alt="Adobe Photoshop 60%" width="150" height="150" /></a> </dt>
</dl>
<dl style="width: 33%;">
<dt> <a title="Adobe Fireworks 80%" rel="shadowbox[post-964];player=img;" href="http://www.web-development-blog.com/wp-content/uploads/2010/03/fireworks_80.jpg"><img title="Adobe Fireworks 80%" src="http://www.web-development-blog.com/wp-content/uploads/2010/03/fireworks_80-150x150.jpg" alt="Adobe Fireworks 80%" width="150" height="150" /></a> </dt>
</dl>
<p><br style="clear: both;" />
<dl style="width: 33%;">
<dt> <a title="Imagemagick 80%" rel="shadowbox[post-964];player=img;" href="http://www.web-development-blog.com/wp-content/uploads/2010/03/imagemagick_80.jpg"><img title="Imagemagick 80%" src="http://www.web-development-blog.com/wp-content/uploads/2010/03/imagemagick_80-150x150.jpg" alt="Imagemagick 80%" width="150" height="150" /></a> </dt>
</dl>
<dl style="width: 33%;">
<dt> <a title="GIMP 86%" rel="shadowbox[post-964];player=img;" href="http://www.web-development-blog.com/wp-content/uploads/2010/03/gimp_86.jpg"><img title="GIMP 86%" src="http://www.web-development-blog.com/wp-content/uploads/2010/03/gimp_86-150x150.jpg" alt="GIMP 86%" width="150" height="150" /></a> </dt>
</dl>
<p> <br style="clear: both;" /></div>
<p>The results after compression is very similar and the file size is between 85KB (fireworks) and 95KB (Photoshop). If you’re looking to down-size another 5-10%, you should try <a rel="nofollow" href="http://developer.yahoo.com/yslow/smushit/">Smush.it</a> a free service from Yahoo. They offer a tool which is able to optimize your images for 5-10% smaller file size without to lower the grade of quality.</p>
<h3>Optimize your JPEG images with ImageMagick and PHP</h3>
<p>If you need to optimize the images for your existing website, the following code might be useful:</p>
<div>
<div>
<pre style="font-family: monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/home/some_directory/'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// the directory with your files</span>
<span style="color: #000088;">$compr</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">80</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// the quality precentage</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$handle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">opendir</span><span style="color: #009900;">(</span><span style="color: #000088;">$dir</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">(</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">!==</span> <span style="color: #009900;">(</span><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">readdir</span><span style="color: #009900;">(</span><span style="color: #000088;">$handle</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
		<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dir</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">is_file</span><span style="color: #009900;">(</span><span style="color: #000088;">$path</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
			<span style="color: #000088;">$ext</span> <span style="color: #339933;">=</span> <span style="color: #990000;">pathinfo</span><span style="color: #009900;">(</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> PATHINFO_EXTENSION<span style="color: #009900;">)</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'/^(jpg|jpeg)$/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
				<span style="color: #990000;">exec</span><span style="color: #009900;">(</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'convert %s -quality %d %s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$compr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">}</span>
		<span style="color: #009900;">}</span>
	<span style="color: #009900;">}</span>
	<span style="color: #990000;">closedir</span><span style="color: #009900;">(</span><span style="color: #000088;">$handle</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</div>
</div>
<p>Just enter the path to the the directory you like to optimize safe the code as a PHP script and execute the file from the command line of browser. Note only the JPEG files are getting compressed.</p>
<p>Optimize your images top make them load faster, but be careful don’t compress them too much.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/best-methods-to-optimize-jpeg-images-for-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>150 Ways to Ruin Your WordPress Site and Your Life</title>
		<link>http://www.phpasks.com/blogs/2010/03/150-ways-to-ruin-your-wordpress-site-and-your-life/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/150-ways-to-ruin-your-wordpress-site-and-your-life/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:36:50 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[Wordpress Expert]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/2010/03/150-ways-to-ruin-your-wordpress-site-and-your-life/</guid>
		<description><![CDATA[Here are some obvious and not so obvious ways to ruin your WordPress website. Some of these will also destroy the relationships with your family and friends. In fact, I guarantee that if you follow these 150 simple steps, you will have a horrible WordPress website and very few friends. Earlier this week I published ]]></description>
			<content:encoded><![CDATA[<div><img title="150 Ways to Ruin Your WordPress Website" src="http://www.montanaprogrammer.com/wp-content/uploads/2010/03/wordpress4.jpg" alt="" width="200" height="150" /></div>
<p>Here are some obvious and not so obvious ways to <strong>ruin your WordPress website</strong>. Some of these will also destroy the relationships with your family and friends. In fact, I guarantee that if you follow these 150 simple steps, you will have a <strong>horrible WordPress website</strong> and very few friends.</p>
<p>Earlier this week I published a list of <a href="http://www.montanaprogrammer.com/wordpress/101-killer-wordpress-plugins/">the best 101 WordPress plugins</a>. Going a long with that huge list, I decided to come out with something similar…but from a different angle.</p>
<p>There are serious elements mixed in with some humor. <img title="150 Ways to Ruin Your WordPress Site and Your Life" src="http://www.montanaprogrammer.com/wp-includes/images/smilies/icon_smile.gif" alt=":)" /> Please note that I am not endorsing any of the illegal activities described in this post.</p>
<p>Let me know if I missed any <strong>WordPress ruining tips</strong>!</p>
<p>#1. Post every few months.</p>
<p>#2. Don’t check spelling or grammar on your posts.</p>
<p>#3. Post nude photos of your wife on the front page.</p>
<p>#4. Constantly change your permalink structure without creating 301 redirects. Google will love you for this.</p>
<p>#5. Post the same killer article every week with a different title.</p>
<p>#6. Copy content from another blog.</p>
<p>#7. Claim you have a PhD.</p>
<p>#8. Never flush your toilet.</p>
<p>#9. Use pink everywhere…especially as the main font color.</p>
<p>#10. Put a bunch of keywords at the bottom of your page, making the font color match the background.</p>
<p>#11. Lie about your age.</p>
<p>#12. Post about Brittany Spears every other day.</p>
<p>#13. Use the same post titles as your competitors.</p>
<p>#14. Copy someone’s post and claim that they stole your content in the comments of their article.</p>
<p>#15. Go to Yahoo Answers, create a question and then answer that question with a different account. Do this and repeat. Make sure you link to an article on your site in every answer.</p>
<p>#16. Spam Forums as much as possible</p>
<p>#17. Use slang words in your posts.</p>
<p>#18. Make sure your best posts are hidden from visitors.</p>
<p>#19. Make it difficult for users to find your home page.</p>
<p>#20. Add music that auto plays on your website. Do not provide a way to turn it off.</p>
<p>#21. Constantly submit your own articles to Digg and Reddit.</p>
<p>#22. Create 25 different twitter accounts and constantly retweet your posts.</p>
<p>#23. Claim you are the son/daughter of Brad Pitt.</p>
<p>#24. Make fun of anyone who comments on your posts.</p>
<p>#25. Stuff your site with ads.</p>
<p>#26. Make sure your contact and comment form are broken. If someone points this out to you, tell them it is because you get so much traffic.</p>
<p>#27. Only promote your website through prayer.</p>
<p>#28. Send an email to your friends with a link to your home page once per day.</p>
<p>#29. Make sure you spend a maximum of 10 minutes on each post.</p>
<p>#30. Put a massive amount of links in each post without explaining what they are for.</p>
<p>#31. Make sure each of your posts is in a different language.</p>
<p>#32. Tell everyone you have aids, but then say you are just kidding.</p>
<p>#33. Use a bright background color.</p>
<p>#34. Resize your images by changing the width and the height attributes.</p>
<p>#35. Make sure to use frames.</p>
<p>#36. Post stupid comments on other blogs because you know this will attract the most attention.</p>
<p>#37. Claim your blog is a joint effort of all the authors of your competitors.</p>
<p>#38. Make sure you require users to register to view your website…before you tell them what your website is about.</p>
<p>#39. Make fun of your family members on your website twice a week… preferably posts with photos.</p>
<p>#40. Include the F bomb with everyone you interact with on Twitter.</p>
<p>#41. Don’t respond to comments.</p>
<p>#42. Always post your titles in all caps.</p>
<p>#43. Whine about the government in every post.</p>
<p>#44. Use the default WordPress theme.</p>
<p>#45. Eat yellow snow.</p>
<p>#46. Put up an article about the top 100 ways to cheat Google.</p>
<p>#47. Make your about page a PDF file that you link to directly.</p>
<p>#48. Avoid using punctuation at all costs.</p>
<p>#49. Misspell post titles.</p>
<p>#50. Thinking that increased load time adds anticipation, make sure all images and photos are not optimized.</p>
<p>#51. On every page of your site, put a line asking people to click on your google ads.</p>
<p>#52. Use a domain name that doesn’t contain any words.</p>
<p>#53. Don’t let anyone under 18 view your website, even if it is not an adult website.</p>
<p>#54. Display a different main navigation menu on every page load.</p>
<p>#55. Click your own Google ads at least 10 times per day.</p>
<p>#56. Put the most popular search engine keywords on the web in the meta keywords field on every page of your site. Make sure to use at least 100 keywords.</p>
<p>#57. Claim your site is only meant to be viewed by men.</p>
<p>#58. Create a post about the top ten ways to be a terrorist.</p>
<p>#59. Make at least one racist comment per post.</p>
<p>#60. Make sure all text is tilted.</p>
<p>#61. Create a contest that offers $500 to the winner. But don’t pay up when the contest is over.</p>
<p>#62. Make sure to talk while you are eating when recording videos.</p>
<p>#63. Whine about your family in at least one post per week.</p>
<p>#64. Post your articles in English, but record and post videos in a different language.</p>
<p>#65. Go with the cheapest web host you can find, such as Blue Host. Specifically because they give you unlimited resources and your site will grow.</p>
<p>#66. Post as many one liner comments on as many blogs as possible.</p>
<p>#67. Write posts when you drunk.</p>
<p>#68. Lie to your customers about the price of your product.</p>
<p>#69. Advertise an ad that says “Buy one get five free!”, but after they place the order let them know that promotion ended last year.</p>
<p>#70. Create pages specifically for top keywords that have nothing to do with your website.</p>
<p>#71. Make fun of handicap people in a post once per week.</p>
<p>#72. Always make promises you cannot keep.</p>
<p>#73. Focus 100% on SEO, but don’t worry about how your visitors feel about your site.</p>
<p>#74. Submit your site to directories in the most high traffic categories, regardless of whether they match your content.</p>
<p>#75. Come out with a “your mom joke” once per week.</p>
<p>#76. If you didn’t graduate from college, make this the first thing your visitors know about your site.</p>
<p>#77. Sell marijuana by the pound on your products page.</p>
<div id="attachment_1165" style="width: 610px;"><img title="150 Ways to Ruin Your WordPress Site and Your Life" src="http://www.montanaprogrammer.com/wp-content/uploads/2010/03/sell-marijuana-wordpress.jpg" alt="wordpress 150 Ways to Ruin Your WordPress Site and Your Life" width="600" height="450" />Photo of some marijuana.</div>
<p>#78. Create a how to guide to being a prostitute.</p>
<p>#79. Post a link to a downloadable virus once per week.</p>
<p>#80. Sign-up your wife on dating sites.</p>
<p>#81. Write one post per week that features the word “retard”.</p>
<p>#82. Comment on your own articles using different names and email addresses.</p>
<p>#83. Install a spam bot on your server that posts spam comments on other blogs.</p>
<p>#84. Fill out as many contact forms as possible and only include a url to your site in the message/description.</p>
<p>#85. Offer to watch kids for a day, but then lock them up into a room. Just make sure to remember to feed them lunch.</p>
<p>#86. Ask for your friends ftp accounts for their websites, and then create a 301 redirect for all of them that goes to your site.</p>
<p>#87. Do not respond to emails any sooner than 2 weeks before you have received them.</p>
<p>#88. Never answer your cell phone.</p>
<p>#89. Do not pickup or do the dishes for 6 months straight.</p>
<p>#90. Email a virus to your friends as a practical joke.</p>
<p>#91. Make sure you charge 3x the amount for shipping as it actually costs.</p>
<p>#92. Post your admin password.</p>
<p>#93. Don’t update your plugins or WordPress installation….ever.</p>
<p>#94. Use your competitors logo for your website.</p>
<p>#95. Don’t include a site search.</p>
<p>#96. Never include photos in your posts.</p>
<p>#97. Urinate under your bed at least once per day.</p>
<p>#98. Use a crappy logo.</p>
<p>#99. Set all of your clocks to 3 hours behind.</p>
<p>#100. Require payment up front for any services you advertise, but don’t complete the service.</p>
<p>#101. Never do anything physical.</p>
<p>#102. Require all of your friends to post a comment once per week or you will never talk to them again.</p>
<p>#103. Never post on a topic that you have written about before.</p>
<p>#104. Block the google bot from accessing your website.</p>
<p>#105. Password protect your whole website, but don’t give anyone the password.</p>
<p>#106. Advertise sexual services on your blog.</p>
<p>#107. Make your main body text font size 10px.</p>
<p>#108. Make fun of a celebrity once per week.</p>
<p>#109. Put up a video of you barfing on your website.</p>
<p>#110. Put up all of your friends email addresses on your website.</p>
<p>#111. Make fun of your friends that are overweight.</p>
<p>#112. Make some of your text look like links, but they are not click able.</p>
<p>#113. Duplicate your killer articles at least 10 times on your site.</p>
<p>#114. Don’t do any research on SEO.</p>
<p>#115. Forget to renew your domain registration.</p>
<p>#116. If you are 13 years old or under, make sure you specify this in each of your posts.</p>
<p>#117. Claim that dropping out of high school is what everyone should do.</p>
<p>#118. Use post titles that do not relate at all with your content.</p>
<p>#119. Post your sister’s diary on your website. Make it a featured post.</p>
<p>#120. Only keep friends that are within 10 lbs of your weight. If they are more than that, tell them they need to gain/lose weight to be your friend.</p>
<p>#121. In your welcome message, say something like: “This website is only meant for Caucasian visitors who weigh less than 200 lbs.”.</p>
<p>#122. Randomly post a photo of a banana every day.</p>
<p>#123. Learn to type only with your feet.</p>
<p>#124. Post a Richard Simmons video once every two weeks.</p>
<p>#125. Never use the word “and” or “is”.</p>
<p>#126. Take photos off of the internet randomly, not caring if you have permission to use them or not.</p>
<p>#127. Forget about your wife on Valentine’s day.</p>
<p>#128. Create a post about each of your competitors and list out what you do not like about each website.</p>
<p>#129. Only test your browser in Chrome.</p>
<p>#130. Make your website 100% flash.</p>
<p>#131. Require everyone who visits your website to first download a pirated eBook.</p>
<p>#132. Claim you are a best-selling author.</p>
<p>#133. Forget to come into work for five days in a row.</p>
<p>#134. Only eat spam for a whole week.</p>
<p>#135. Take a shower once per 6 months.</p>
<p>#136. Put your parents phone number as the contact number on your website.</p>
<p>#137. Take a dump in the sink and tell your wife to clean it up.</p>
<p>#138. Pretend you are carrying a grenade on an airplane.</p>
<p>#139. Lock yourself into an airplane bathroom for the entire flight.</p>
<p>#140. Don’t check your site after upgrading your plugins.</p>
<p>#141. Redirect 404 pages to your competitors home page.</p>
<p>#142. Steal your neighbors pets.</p>
<p>#143. Poop in your neighbor’s lawn.</p>
<p>#144. Talk bad about your boss on your blog.</p>
<p>#145. Don’t create titles for your posts.</p>
<p>#146. Claim you have the #1 position for a popular search engine keyword.</p>
<p>#147. Post comments on other blogs, letting them know that your site is better than theirs.</p>
<p>#148. Forget to pay your hosting bill.</p>
<p>#149. Before you write any content, make sure you get at least 10,000 visitors to your domain.</p>
<p>#150. Exchange links with other websites, but take off their link after a few days.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/150-ways-to-ruin-your-wordpress-site-and-your-life/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image over Contain Layer using jQuery</title>
		<link>http://www.phpasks.com/blogs/2010/03/image-over-contain-layer-using-jquery/</link>
		<comments>http://www.phpasks.com/blogs/2010/03/image-over-contain-layer-using-jquery/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 06:52:05 +0000</pubDate>
		<dc:creator>Asif Khalyani</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpasks.com/blogs/?p=1215</guid>
		<description><![CDATA[Image over Contain Layer using jQuery Demo Suffolk County Council Web design and build / CMS integration / E-Newsletters / SEO Visit the website Earthmoves Design Web design and build / CMS integration / Branding Visit the website Gwynedd Council Web design and build / Site management Visit the website Keep your site fresh and ]]></description>
			<content:encoded><![CDATA[<h3>Image over Contain Layer using jQuery</h3>
<h2>Demo</h2>
<link rel="stylesheet" href="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/style.css" type="text/css" media="screen, projection"><script type="text/javascript" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/jquery.js"></script><br />
<script type="text/javascript" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/jquery_minified.js"></script>
<div class="container_16">
<div class="boxgrid caption"> <img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/ssp.jpg" alt="Suffolk County Council" width="210" height="176"><!-- START of .boxgrid caption -->
<div style="top: 127px;" class="cover boxcaption">
<h3>Suffolk County Council</h3>
<p class="workdesc">Web design and build / CMS integration / E-Newsletters / SEO</p>
<p><a bitly="BITLY_PROCESSED" class="website" href="http://www.phpasks.com/contact-us.html" title="visit the Transforming Suffolk website">Visit the website</a></div>
<p><!-- end of .boxgrid caption --></div>
<p><!-- end of .cover boxcaption -->
<div class="boxgrid caption"> <img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/emd.jpg" alt="Earthmoves Design" width="210" height="176">
<div class="cover boxcaption">
<h3>Earthmoves Design</h3>
<p class="workdesc">Web design and build / CMS integration / Branding</p>
<p><a bitly="BITLY_PROCESSED" class="website" href="http://www.phpasks.com/contact-us.html" title="visit the Earthmoves Design website">Visit the website</a> </div>
<p><!-- end of .boxgrid caption --></div>
<p><!-- end of .cover boxcaption --><br clear="all" />
<div class="boxgrid caption">
<div class="cover boxcaption">
<h3>Gwynedd Council</h3>
<p class="workdesc">Web design and build / Site management</p>
<p><a bitly="BITLY_PROCESSED" class="website" href="http://www.phpasks.com/contact-us.html" title="visit the Health Challenge Gwynedd website">Visit the website</a> </div>
<p><!-- end of .boxgrid caption --></div>
<p><!-- end of .cover boxcaption --><br clear="all" />
<div class="divider"><!-- end of .grid_4 -->
<div class="boxgrid captionfull"> <img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/cms.jpg" alt="Manage your website with a content management system" width="210" height="176">
<div class="cover boxcaption">
<p class="workdesc2">Keep your site fresh and up to date with our easy to use, yet powerful content management system</p>
<p><a bitly="BITLY_PROCESSED" class="website" href="http://www.phpasks.com/contact-us.html" title="get a quote">Try a demo or get a quote</a></p>
</div>
<p><!-- end of .boxgrid caption --></div>
<p><!-- end of .cover boxcaption -->
<div class="boxgrid captionfull"> <img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/ecom.jpg" alt="Sell online with our E-Commerce system" width="210" height="176">
<div class="cover boxcaption">
<p class="workdesc2">Give new and existing customers a secure, easy to use platform to purchase from you online</p>
<p><a bitly="BITLY_PROCESSED" class="website" href="http://www.phpasks.com/contact-us.html" title="get a quote">Try a demo or get a quote</a></p>
</div>
<p><!-- end of .boxgrid caption --></div>
<p><!-- end of .cover boxcaption --><br clear="all" />
<div class="boxgrid captionfull"> <img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/email.jpg" alt="Send email campaigns with our E-Mail Newsletter system" width="210" height="176">
<div class="cover boxcaption">
<p class="workdesc2">Send branded, rich, targeted email campaigns and track results using our E-Mail campaign system</p>
<p><a bitly="BITLY_PROCESSED" class="website" href="http://www.phpasks.com/contact-us.html" title="get a quote">Try a demo or get a quote</a></p>
</div>
<p><!-- end of .boxgrid caption --></div>
<p><!-- end of .cover boxcaption --></div>
</div>
<p><br clear="all" /><br />
<h2>HTML Source Donwload</h2>
<pre>
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html dir="ltr" xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml" lang="en-gb"&gt;
&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
&lt;title&gt;Web design and online marketing by Blend, Ipswich, Suffolk, UK&lt;/title&gt;
&lt;link rel="stylesheet" href="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/style.css" type="text/css" media="screen, projection"&gt;
&lt;script type="text/javascript" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/jquery_minified.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
&lt;div&gt; &lt;img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/ssp.jpg" alt="Suffolk County Council" width="210" height="176"&gt;
&lt;!-- START of .boxgrid caption --&gt;
&lt;div style="top: 127px;"&gt;
&lt;h3&gt;Suffolk County Council&lt;/h3&gt;
&lt;p&gt;Web design and build / CMS integration / E-Newsletters / SEO&lt;/p&gt;
&lt;a bitly="BITLY_PROCESSED" href="http://www.phpasks.com/contact-us.html" title="visit the Transforming Suffolk website"&gt;Visit the website&lt;/a&gt;
&lt;/div&gt;
&lt;!-- end of .boxgrid caption --&gt;
&lt;/div&gt;
&lt;!-- end of .cover boxcaption --&gt;
&lt;div&gt; &lt;img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/emd.jpg" alt="Earthmoves Design" width="210" height="176"&gt;
&lt;div&gt;
&lt;h3&gt;Earthmoves Design&lt;/h3&gt;
&lt;p&gt;Web design and build / CMS integration / Branding&lt;/p&gt;
&lt;a bitly="BITLY_PROCESSED" href="http://www.phpasks.com/contact-us.html" title="visit the Earthmoves Design website"&gt;Visit the website&lt;/a&gt; &lt;/div&gt;
&lt;!-- end of .boxgrid caption --&gt;
&lt;/div&gt;
&lt;!-- end of .cover boxcaption --&gt;
&lt;div&gt; &lt;img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/ghia.jpg" alt="Gwynedd Council" width="210" height="176"&gt;
&lt;div&gt;
&lt;h3&gt;Gwynedd Council&lt;/h3&gt;
&lt;p&gt;Web design and build / Site management&lt;/p&gt;
&lt;a bitly="BITLY_PROCESSED" href="http://www.phpasks.com/contact-us.html" title="visit the Health Challenge Gwynedd website"&gt;Visit the website&lt;/a&gt; &lt;/div&gt;
&lt;!-- end of .boxgrid caption --&gt;
&lt;/div&gt;
&lt;!-- end of .cover boxcaption --&gt;
&lt;div&gt;
&lt;!-- end of .grid_4 --&gt;
&lt;div&gt; &lt;img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/cms.jpg" alt="Manage your website with a content management system" width="210" height="176"&gt;
&lt;div&gt;
&lt;p&gt;Keep your site fresh and up to date with our easy to use, yet powerful content management system&lt;/p&gt;
&lt;p&gt;&lt;a bitly="BITLY_PROCESSED" href="http://www.phpasks.com/contact-us.html" title="get a quote"&gt;Try a demo or get a quote&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;!-- end of .boxgrid caption --&gt;
&lt;/div&gt;
&lt;!-- end of .cover boxcaption --&gt;
&lt;div&gt; &lt;img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/ecom.jpg" alt="Sell online with our E-Commerce system" width="210" height="176"&gt;
&lt;div&gt;
&lt;p&gt;Give new and existing customers a secure, easy to use platform to purchase from you online&lt;/p&gt;
&lt;p&gt;&lt;a bitly="BITLY_PROCESSED" href="http://www.phpasks.com/contact-us.html" title="get a quote"&gt;Try a demo or get a quote&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;!-- end of .boxgrid caption --&gt;
&lt;/div&gt;
&lt;!-- end of .cover boxcaption --&gt;
&lt;div&gt; &lt;img src="http://www.phpasks.com/blogs/wp-content/uploads/2010/03/email.jpg" alt="Send email campaigns with our E-Mail Newsletter system" width="210" height="176"&gt;
&lt;div&gt;
&lt;p&gt;Send branded, rich, targeted email campaigns and track results using our E-Mail campaign system&lt;/p&gt;
&lt;p&gt;&lt;a bitly="BITLY_PROCESSED" href="http://www.phpasks.com/contact-us.html" title="get a quote"&gt;Try a demo or get a quote&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;!-- end of .boxgrid caption --&gt;
&lt;/div&gt;
&lt;!-- end of .cover boxcaption --&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;!--end of container_16 --&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.phpasks.com/blogs/2010/03/image-over-contain-layer-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

