<?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>Midstride Solutions &#187; andre</title>
	<atom:link href="http://blog.midstride.com/author/andre/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.midstride.com</link>
	<description>Powerful, simple &#38; easy to use.</description>
	<lastBuildDate>Fri, 16 Oct 2009 16:41:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Top 10 links for December Week 1 &#8211; 2008</title>
		<link>http://blog.midstride.com/2008/12/08/top-10-links-for-december-week-1-2008/</link>
		<comments>http://blog.midstride.com/2008/12/08/top-10-links-for-december-week-1-2008/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 05:41:28 +0000</pubDate>
		<dc:creator>andre</dc:creator>
				<category><![CDATA[Web Strategy]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.midstride.com/?p=37</guid>
		<description><![CDATA[Here is the first installment of our top 10 links for the week &#8211; a selection of ten links we see as being very useful and important to the web development/business crowd.  This list covers both technical articles for developers and higher level business ones. 10 Useful RSS-Tricks and Hacks for WordPress &#8211; Smashingmagazine Great [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the first installment of our top 10 links for the week &#8211; a selection of ten links we see as being very useful and important to the web development/business crowd.  This list covers both technical articles for developers and higher level business ones.<strong><br />
</strong></p>
<ol>
<li><a href="http://www.smashingmagazine.com/2008/12/02/10-useful-rss-hacks-for-wordpress/" target="_blank">10 Useful RSS-Tricks and Hacks for WordPress &#8211; Smashingmagazine</a><strong><br />
</strong>Great tips for any user of wordpress that relies on RSS for syndicating content.  Most of these tips show you how to gain more control over your RSS feeds.</li>
<li><a href="http://www.ibm.com/developerworks/opensource/library/os-php-5goodhabits/index.html?ca=dgr-jw64os-php-5goodhabits&amp;S_TACT=105AGY46&amp;S_CMP=GRsitejw64" target="_blank">5 good programming habits in PHP</a><br />
General rules of thumbs for php programmers.   Some of the rules may make you think twice, like the rule of &#8220;Never copy and paste&#8221;.</li>
<li><a href="http://www.dailyblogtips.com/what-is-more-important-to-succeed-online-business-or-technical-skills/" target="_blank">What is More Important To Succeed Online:  Business or Technical Skills?</a><br />
A question for the ages, at least in the IT field, is it more important to be business or technical minded?  A very interesting article on how these skills have attributed to the success of several companies.</li>
<li><a href="http://news.cnet.com/8301-17939_109-10114050-2.html?part=rss&amp;tag=feed&amp;subj=Webware" target="_blank">Firefox 3.1 beta news &#8211; web workers</a><br />
A CNET article on Firefox 3.1.  The interesting part is how &#8220;web workers&#8221; can process work in the background.  Background processing would push the RIA movement further and I&#8217;m sure would lead to some very novel ideas from early adopters.</li>
<li><a href="http://nettuts.com/articles/news/how-to-setup-a-dedicated-web-server-for-free/" target="_blank">How to Setup a Dedicated Web Server for free &#8211; with Ubuntu</a><br />
A practical and useful article on how to setup a web server.  This is a very well written article that shows how far Linux has come in terms of ease of use.</li>
<li><a href="http://blog.guykawasaki.com/2008/12/how-to-use-twit.html" target="_blank">How to use Twitter as a tool</a><br />
An article by Guy Kawasaki on how to use Twitter for productivity.  It&#8217;s a very detailed post and for those new to Twitter, it explains the utility factor of Twitter beyond just being a gossip tool.</li>
<li><a href="http://www.smashingmagazine.com/2008/12/03/online-advertising-and-its-impact-on-web-design/" target="_blank">Online Advertising and Its Impact on Web Design</a><br />
An excellent article from Smashing Magazine on how online advertising affects web design.  It&#8217;s an interesting topic as web advertising is a primary means of revenue for the majority of blogs.</li>
<li><a href="http://nettuts.com/articles/web-roundups/top-10-biggest-web-dev-blunders-of-2008/" target="_blank">Top 10 Web Dev Blunders of 2008</a><br />
A list of some of the biggest &#8220;mistakes&#8221; we&#8217;ve seen on the web this year.</li>
<li><a href="http://www.techcrunch.com/2008/12/02/who-protects-the-internet/" target="_blank">Who Protects The Internet?</a><br />
Who does protect the Internet?  This article should be of interest to anyone who uses the Internet, so that&#8217;s a lot of people.  Techcrunch takes a go at reviewing where we are with the Internet.</li>
<li><a href="http://www.dailyblogtips.com/referrer-detector-wordpress-plugin/" target="_blank">Referrer Detector WordPress Plugin</a><br />
A great wordpress tool to greet your users coming from specific sites.</li>
</ol>
<p>I hope you find these articles useful.  You can contribute your own links by visiting this <a href="http://www.buncholinks.com/p/andreliem/decweek1top">buncholink</a> which groups related links together in a useful manner.</p>
<p><script src="http://www.buncholinks.com/widget/script/i/164/k/d864d5977385c962710cad06a4913732" type="text/javascript"></script></p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/share_save?sitename=Midstride%20Solutions&amp;siteurl=http%3A%2F%2Fblog.midstride.com%2F&amp;linkname=Top%2010%20links%20for%20December%20Week%201%20%E2%80%93%202008&amp;linkurl=http%3A%2F%2Fblog.midstride.com%2F2008%2F12%2F08%2Ftop-10-links-for-december-week-1-2008%2F"><img src="http://blog.midstride.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Top 10 links for December Week 1 – 2008";
		a2a_linkurl="http://blog.midstride.com/2008/12/08/top-10-links-for-december-week-1-2008/";
						    </script>
    <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.midstride.com/2008/12/08/top-10-links-for-december-week-1-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 tips and tools to optimize your php application &#8211; Part 1 simple</title>
		<link>http://blog.midstride.com/2008/12/01/5-tips-and-tools-to-optimize-your-php-application-part-1-simple/</link>
		<comments>http://blog.midstride.com/2008/12/01/5-tips-and-tools-to-optimize-your-php-application-part-1-simple/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 06:41:26 +0000</pubDate>
		<dc:creator>andre</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[minify]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[yslow]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.midstride.com/?p=33</guid>
		<description><![CDATA[With php becoming a more mature language and frameworks becoming a standard practice, it&#8217;s increasingly important to analyze your code and test the performance where possible. Frameworks and libraries can speed up the development time and make code maintenance simpler, but it&#8217;s important you understand how they work.  It&#8217;s not just the framework itself but [...]]]></description>
			<content:encoded><![CDATA[<p>With php becoming a more mature language and frameworks becoming a standard practice, it&#8217;s increasingly important to analyze your code and test the performance where possible.</p>
<p>Frameworks and libraries can speed up the development time and make code maintenance simpler, but it&#8217;s important you understand how they work.  It&#8217;s not just the framework itself but the entire footprint your application leaves when a user visits a specific page.  Ask yourself what&#8217;s involved from the database, to the code/framework, and then to the client through http requests.<br />
<span id="more-33"></span><br />
After experiencing some issues with an application running the Zend Framework, I realized there were a lot of things I was not doing to optimize my application.  There are simple and more complex actions you can take to speed up your application.  Since time is precious, and developers with an expertise on optimization are not always available, I&#8217;ve split this post into two sections (simple and more advanced).  This post focuses on the simple part.</p>
<p><strong>Simple tips and tools<br />
</strong></p>
<ol>
<li><strong>Use Firebug with YSlow<br />
</strong>Firebug and YSlow are powerful tools to analyze the front end of your site.  Run the most common request on your site and see what YSlow says.  Expect a low grade, probably a D or lower.  If you can reach a level C or greater you&#8217;re doing really well as some of the requirements are not practical for most applications.</p>
<blockquote><p>How-to:<br />
<strong>Net</strong>: How many calls are there?  Try to minize these calls and definitely remove any 404 calls as they can eat up server resources.</p>
<p><strong>Console</strong>:  Do you have a lot of POST calls?  Some libraries, like dojo&#8217;s javascript framework, can make a lot of POST requests.  Reduce these if possible.</p>
<p><strong>YSlow</strong>: Rules I would pay attention to:<br />
1. Make fewer HTTP Requests<br />
3. Add an Expires Header<br />
4. Gzip components (server related)<br />
5. Put CSS at the top<br />
6. Put JS at the bottom (not always possible)<br />
7. Avoid CSS expressions<br />
10. Minify JS</p></blockquote>
<p>Resources:<br />
<a href="http://getfirebug.com/">http://getfirebug.com/</a><br />
<a href="http://developer.yahoo.com/yslow/">http://developer.yahoo.com/yslow/</a><br />
<a href="http://developer.yahoo.com/performance/rules.html ">http://developer.yahoo.com/performance/rules.html </a></li>
<li><strong>Minify Javascript and CSS<br />
</strong>Minification is the process of compacting your scripts by removing extraneous content such as white space.   In addition, minification can make attempts at refactoring the code to remove redunancies.  If you want to play it safe, only remove white space to ensure your code is still running. The Yahoo compressor is one of the best minifiers out there and reduces both Javascript and CSS by a significant percentage.</p>
<blockquote><p>How-to:<br />
<strong>java -jar yuicompressor-x.y.z.jar -o style_minified.css style.css</strong></p>
<p>add the &#8220;&#8211;nomunge&#8221; to only do whitespace compressions.</p></blockquote>
<p>Resources:<br />
<a href="http://developer.yahoo.com/yui/compressor/">http://developer.yahoo.com/yui/compressor/</a><br />
<a href="http://dojotoolkit.org/docs/shrinksafe">http://dojotoolkit.org/docs/shrinksafe</a><br />
<a href="http://dean.edwards.name/packer/ ">http://dean.edwards.name/packer/ </a></li>
<li><strong>Merge css and js http requests</strong>- manually or automated<br />
Reduce the amount of calls you make to various CSS and JS files by merging them to one URL.  This is more work but will reduce the overhead.</p>
<blockquote><p>How-to &#8211; manually:<br />
This is really easy, take your css and copy and paste them together into one file.  Make sure your preserve the order of your css.  The same applies to your Javascript files.</p>
<p>How-to &#8211; Automated &#8211; google or your own custom:<br />
Google has a php script which can take various sources and return them as one.</p></blockquote>
<p>Resources:<br />
<a href="http://code.google.com/p/minify/">http://code.google.com/p/minify/</a><br />
<a href="http://reinholdweber.com/?p=37">http://reinholdweber.com/?p=37</a></li>
<li><strong>CSS Background Images are bad &#8211; usually</strong><br />
Using a div for all of your images with a background image is not that great for performance as it requires more calls.  I&#8217;ll be the first to admit it&#8217;s my favourite way to design, but you should try to avoid them where possible.  In addition, for hover states try using one large image with background-position calls to show specific parts.</p>
<blockquote><p>How to:<br />
Use <em><strong><code><span style="color: #000000;">background-position </span></code></strong></em>to select which portion of the large image you want to show.  There isn&#8217;t much more to explain.</p></blockquote>
</li>
<li><strong>GZip<br />
</strong>Gzipping files on the server side will reduce the amount of overhead significantly.  It adds a bit more on the server side, but generally the pay off should be well worth it.</p>
<blockquote><p>How to:<br />
It depends on your server situation, but here&#8217;s a snippet:<br />
mod_gzip_on Yes<br />
mod_gzip_item_include mime ^application/x-javascript$</p>
<p>Refer to <a href="http://snipplr.com/view/9017/gzip-your-components/">http://snipplr.com/view/9017/gzip-your-components/</a> for details</p></blockquote>
<p>Resources:<br />
<a href="http://developer.yahoo.com/performance/rules.html#gzip" target="_blank">http://developer.yahoo.com/performance/rules.html#gzip</a><br />
<a href="http://snipplr.com/view/9017/gzip-your-components/">http://snipplr.com/view/9017/gzip-your-components/</a></li>
</ol>
<p><strong>Conclusion<br />
</strong>That wraps up the simple part of this tutorial&#8230; really, that&#8217;s it!  The focus of these posts is to keep them simple and easy to use.  You may be surprised at how much faster your application runs when you apply these techniques.  I hope you found these useful or at least agree that these are good practices to apply.  In the next part I will examine more advanced methods of optimizing your application.</p>
<p><strong>Feedback<br />
</strong>Your feedback is always appreciated.  In addition to commenting, if you have more resources, please add them to my growing list of links through this buncholink</p>
<p><script src="http://www.buncholinks.com/widget/script/i/162/k/8b5f477e74ec6ed2ad68064aec4034c0" type="text/javascript"></script></p>
<p>It&#8217;s a simple way to organize a group of links together.</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/share_save?sitename=Midstride%20Solutions&amp;siteurl=http%3A%2F%2Fblog.midstride.com%2F&amp;linkname=5%20tips%20and%20tools%20to%20optimize%20your%20php%20application%20%E2%80%93%20Part%201%20simple&amp;linkurl=http%3A%2F%2Fblog.midstride.com%2F2008%2F12%2F01%2F5-tips-and-tools-to-optimize-your-php-application-part-1-simple%2F"><img src="http://blog.midstride.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="5 tips and tools to optimize your php application – Part 1 simple";
		a2a_linkurl="http://blog.midstride.com/2008/12/01/5-tips-and-tools-to-optimize-your-php-application-part-1-simple/";
						    </script>
    <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.midstride.com/2008/12/01/5-tips-and-tools-to-optimize-your-php-application-part-1-simple/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>5 tips and tools to develop php applications fast</title>
		<link>http://blog.midstride.com/2008/09/09/5-tips-to-develop-php-applications-fast/</link>
		<comments>http://blog.midstride.com/2008/09/09/5-tips-to-develop-php-applications-fast/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 05:00:15 +0000</pubDate>
		<dc:creator>andre</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php frameworks]]></category>
		<category><![CDATA[rapid application development]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.midstride.com/?p=19</guid>
		<description><![CDATA[In this post, I will discuss 5 tips and tools that the php community has provided to speed up development time and improve code quality.  These should help you out if you don't already know them, but if you do I would like to hear what you use to speed up your development time.]]></description>
			<content:encoded><![CDATA[<p>When web applications like <a href="http://www.basecamphq.com/" target="_blank">basecamp</a> started appearing, a lot of attention started turning to <a href="http://www.rubyonrails.org/" target="_blank">Ruby on Rails</a>.  Suddenly small groups of technically driven people could release powerful applications in a month or two.  With this awareness, the usability standards for web applications increased and so did the technical challenges for web developers and designers.  This movement sort of left php developers in the dust for a while.  While CakePHP and other frameworks came to the rescue, it didn&#8217;t seem like the php community wanted to match Ruby on Rails.  If anything, php has been looking to retain its strong foundations of being built upon a powerful, easy to use library and integrating new &#8220;web 2.0&#8243; like ideas to do more than Ruby on Rails.</p>
<p>In this post, I will discuss 5 tips and tools that the php community has provided to speed up development time and improve code quality.  These should help you out if you don&#8217;t already know them, but if you do I would like to hear what you use to speed up your development time.</p>
<p><span id="more-19"></span></p>
<ol>
<li><strong>Framework with the Model View Controller (MVC):<br />
</strong>This is old news, the MVC pattern is an industry accepted pattern to improve the organization and overall quality of your code.  Put your database code in the model layer, visual UI code in the view, and business application logic in the controller.  If you don&#8217;t know the MVC layer, you really should.</p>
<blockquote><p>My choice: <a href="http://framework.zend.com/manual/en/zend.controller.html" target="_blank">Zend Framework</a><br />
Why?  Easy to pick and choose what you want to use; strong momentum behind it; good documentation.</p></blockquote>
<p>Resources:<br />
<a href="http://framework.zend.com/manual/en/zend.controller.html" target="_blank">http://framework.zend.com/manual/en/zend.controller.html</a><br />
<a href="http://www.cakephp.org/" target="_blank">http://www.cakephp.org</a><br />
<a href="http://www.symfony-project.org/" target="_blank">http://www.symfony-project.org</a><br />
<a href="http://codeigniter.com/" target="_blank">http://codeigniter.com/</a></li>
<li><strong>AJAX Frameworks:</strong><br />
Also old news, you should become familiar with a common AJAX framework.  Scriptaculous, mootools, jquery, and dojo to name a few&#8230; these frameworks can all do similar things and will make your clients go ooh and ahh.  Actually, these days AJAX interaction is become standard.  Being a Zend developer, I would suggest acquainting yourself with the Dojo framework.  It&#8217;s probably the largest and most complex of them all but is very powerful.</p>
<blockquote><p>My choice: <a href="http://dojotoolkit.org/ " target="_blank">Dojo<br />
</a>Why?  Zend has adopted it into the zend framework; easy to extend; large resource of reusable widgets to use.</p></blockquote>
<p>Resources:<br />
<a href="http://en.wikipedia.org/wiki/Ajax_framework" target="_blank">http://en.wikipedia.org/wiki/Ajax_framework</a><br />
<a href="http://www.phpframeworks.com/" target="_blank">http://www.phpframeworks.com/</a><br />
<a href="http://mootools.net/" target="_blank">http://mootools.net/</a><br />
<a href="http://jquery.com/" target="_blank">http://jquery.com/</a><br />
<a href="http://script.aculo.us/" target="_blank">http://script.aculo.us/</a><br />
<a href="http://www.prototypejs.org/">http://www.prototypejs.org/</a><br />
<a href="http://dojotoolkit.org/ " target="_blank">http://dojotoolkit.org/ </a></li>
<li><strong>Integrated Development Environment (IDE):<br />
</strong> I won&#8217;t go into much detail here, if you&#8217;re developing objected oriented code or using a lot of libraries you should get a good IDE.  Eclipse PDT is my favourite because it&#8217;s free and has some very useful plugins to extend it.  My basic requiremnts are resource/file management of libraries, auto completion, basic syntax validation, and basic debugging tools.</p>
<blockquote><p>My choice:  <a href="http://www.eclipse.org/pdt/" target="_blank">Eclipse PDT</a><br />
Why?  It&#8217;s free and provides all the basic features an IDE should have.</p></blockquote>
<p>Resources:<br />
<a href="http://www.eclipse.org/pdt/" target="_blank">http://www.eclipse.org/pdt/</a><br />
<a href="http://www.zend.com/en/products/studio/" target="_blank">http://www.zend.com/en/products/studio/</a><br />
<a href="http://www.ibm.com/developerworks/opensource/library/os-php-ide/index.html" target="_blank">http://www.ibm.com/developerworks/opensource/library/os-php-ide/index.html</a></li>
<li><strong>Database Creation/Management Software</strong>:<br />
Managing a database schema can become tedious error prone thing to do.  If you don&#8217;t have a dedicated database team, and in many cases are the web and database developer, then you should be doing more than handling your schema in mysql (or your database of choice).  MySql has recently released workbench, a database management software that is really powerful.  I prefer DBDesigner 4 right now because it&#8217;s simple to use and feeds into <a href="http://propel.tigris.org/" target="_blank">propel db</a> well.  But I plan on moving over to workbench in the near future as it&#8217;s really the continuation of DBDesigner.</p>
<blockquote><p>My choice: <a href="http://fabforce.net/dbdesigner4/ " target="_blank"> DBDesigner</a>, but not for long.<br />
Why?  It&#8217;s simple to manage your database schema visually and exports well.</p></blockquote>
<p>Resources:<br />
<a href="http://dev.mysql.com/workbench/" target="_blank">http://dev.mysql.com/workbench/</a><br />
<a href="http://fabforce.net/dbdesigner4/ " target="_blank">http://fabforce.net/dbdesigner4/ </a></li>
<li><strong>Object Relational Mapping (ORM)</strong>:<br />
If you don&#8217;t know what this is, it&#8217;s basically a way of mapping your database tables to objects.  It&#8217;s so you don&#8217;t have to think about how to connect your logic/business code to the database.  Also, if you use tools like Propel DB you don&#8217;t have to code this as it generates it all for you.  While your application may not perform as well as with straight SQL, you will code faster and you can find ways to tweak bottle neck cases.</p>
<blockquote><p>My choice:  <a href="http://propel.tigris.org/" target="_blank">Propel DB<br />
</a>Why?  It&#8217;s easy to use and integrate into the zend framework; There aren&#8217;t many other options.</p></blockquote>
<p>Resources:<br />
<a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank">http://en.wikipedia.org/wiki/Object-relational_mapping</a><br />
<a href="http://propel.tigris.org/" target="_blank">http://propel.tigris.org/ </a></li>
</ol>
<h2>Wrap Up / Further thoughts</h2>
<p>I hope this was useful for you.  Everyone has their own combination that works for them, and in a lot of cases the company forces you to use one.  Where I work, we can use whatever combination we want and I know there are many.  I would like to hear what your setup is like, what IDE, framework, and OS works for you and why?</p>
<p>Comment/Get the links for this post here:<br />
<script src="http://www.buncholinks.com/widget/script/i/59/k/305ff773469a6fcd760e059d2c266b2c" type="text/javascript"></script></p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/share_save?sitename=Midstride%20Solutions&amp;siteurl=http%3A%2F%2Fblog.midstride.com%2F&amp;linkname=5%20tips%20and%20tools%20to%20develop%20php%20applications%20fast&amp;linkurl=http%3A%2F%2Fblog.midstride.com%2F2008%2F09%2F09%2F5-tips-to-develop-php-applications-fast%2F"><img src="http://blog.midstride.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="5 tips and tools to develop php applications fast";
		a2a_linkurl="http://blog.midstride.com/2008/09/09/5-tips-to-develop-php-applications-fast/";
						    </script>
    <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.midstride.com/2008/09/09/5-tips-to-develop-php-applications-fast/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Integrating AJAX/Dojo into the Zend MVC in 8 steps.</title>
		<link>http://blog.midstride.com/2008/08/26/integrating-ajaxdojo-into-the-zend-mvc-in-8-steps/</link>
		<comments>http://blog.midstride.com/2008/08/26/integrating-ajaxdojo-into-the-zend-mvc-in-8-steps/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 04:39:23 +0000</pubDate>
		<dc:creator>andre</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.midstride.com/?p=7</guid>
		<description><![CDATA[If you have been following the Zend Framework at all, you'll know that Dojo has been selected as the UI library to be adopted into the Zend Framework. The question is what does this exactly mean? ]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p><a href="http://blog.midstride.com/wp-content/uploads/2008/09/zend_dojo.jpg"><img class="alignnone size-thumbnail wp-image-14 alignleft" style="float: left;" title="zend_dojo" src="http://blog.midstride.com/wp-content/uploads/2008/09/zend_dojo-150x118.jpg" alt="" width="150" height="118" /></a>If you have been following the <a href="http://framework.zend.com/" target="_blank">Zend Framework</a> at all, you&#8217;ll know that <a href="http://dojotoolkit.org/">Dojo </a>has been selected as the UI library to be adopted into the Zend Framework.  The question is what does this exactly mean?  I&#8217;m still trying to figure out how they are going to use dojo, but right now with release 1.6 you can create dojo widgets (e.g. &#8211; date pickers, currency boxes, specialized buttons etc&#8230;) in code with the Zend_Dojo object.   That being said, you still need to learn a few more things to create a useful and reusable AjAX framework with Zend.<br />
<span id="more-7"></span></p>
<h3>The Goal</h3>
<p>This tutorial will explain how to create a reusable UI AJAX layer with dojo that communicates to the Zend controller class.  I&#8217;ll provide some basic code that will show you one way of creating a reusable framework that makes it easier to organize your javascript/ajax and controller layer.</p>
<h3>Prerequisites</h3>
<p>Before you proceed, you&#8217;ll need to read up on how to setup the Zend MVC framework.</p>
<ul>
<li><a href="http://framework.zend.com/manual/en/zend.controller.html">Zend Framework with a MVC structure</a></li>
<li><a href="http://dojotoolkit.org/downloads">Dojo framework</a></li>
</ul>
<h3>The Steps</h3>
<p>1. Setup the Zend Framework and a MVC structure</p>
<p>2. Create the controller class file (e.g. &#8211; MidstrideController.php)</p>
<p>3. Create the view folder &#8220;midstride&#8221; in the view/scripts directory.</p>
<p>4. Create the file &#8220;index.phtml&#8221; in the midstride views/scripts folder.</p>
<p>5. Create an empty javascript file called ajaxmethods.js and place it in your javascript folder.</p>
<p><em><strong>-check up-<br />
</strong></em>Your file structure should look something like this now:</p>
<p>-/application/controller/MidstrideController.php<br />
-/application/views/scripts/midstride/index.phtml<br />
-/www/javascript/ajaxmethods.js<br />
-/www/scriptslib/dojo-release-1.1.1</p>
<p>Where application is your MVC folder and www is the directory for your assets and index.php bootstrap file.</p>
<p>5. Add the javascript code to the header of index.phtml</p>
<pre class="programlisting"> <code>
<span style="color: #000000;">
&lt;script type="text/javascript" src="&lt;?php echo $this-&gt;baseUrl; ?&gt;/javascript/ajaxmethods.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript" src="&lt;?php echo $this-&gt;baseUrl;?&gt;/scriptslib/dojo-release-1.1.1/dojo/dojo.js"         djConfig="parseOnLoad: true"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;

dojo.require("dojo.parser");

&lt;/script&gt;

</span>
</code></pre>
<p>In this case, the baseUrl is a short cut variable defined in your controller class<br />
e.g. &#8211; $this-&gt;view-&gt;baseUrl = $this-&gt;_request-&gt;getBaseUrl();   //gets the root of your application</p>
<p>6. Add some sample form information to index.phml</p>
<pre class="programlisting"> <code>
<span style="color: #000000;">
&lt;div id="status_message"&gt;&lt;!-- ajax messages go here--&gt;&lt;/div&gt;

&lt;form id="ajax_form"&gt;

&lt;input type="text" name="test_input" value="12345" /&gt;

&lt;input id="submit_button" type="submit"

value="submit"

onclick="formPost('&lt;?php echo $this-&gt;baseUrl ?&gt;/midstride/ajaxcall',"ajax_form","ajax_loader","submit_button") /&gt;

&lt;div id="ajax_loader" class="ajax_loader" style="display:none;"  /&gt;

&lt;/form&gt;

</span>
</code></pre>
<p>This form will call the javascript function &#8220;formPost&#8221; with the id of the ajax loader which is currently hidden.  The next step is to define the javascript function which will do the ajax call.</p>
<p>7. Code a reusable javascript ajax function</p>
<pre class="programlisting"> <code>
<span style="color: #000000;">
function formPost(destinationUrl, formId, loaderId, submitId)

{

var useAjaxLoader= true;

var hideSubmitAction = true;

if (loaderId===undefined) {     useAjaxLoader = false; }

if (submitId===undefined) {     hideSubmitAction  = false; }

var postParams = { url: destinationUrl,

load: function(data) {

dojo.eval(data);

//hide ajax loader

if (useAjaxLoader)    { dojo.byId(loaderId).style.display = "none";}

if (hideSubmitAction) { dojo.byId(submitId).style.display = "";} },

error: function(data) { console.debug("An error occurred: ", data); },

form: formId,

timeout: 4000,

headers: { "X-Requested-With": "XMLHttpRequest" }

};

//show ajax loader

if (hideSubmitAction) {dojo.byId(submitId).style.display = "none";}

if (useAjaxLoader)    {dojo.byId(loaderId).style.display = "";} //block

dojo.xhrPost(postParams);

}

</span>
</code></pre>
<p>There&#8217;s a lot going on in this code but it&#8217;s not that complex.  In short:</p>
<ul>
<li>destinationUrl = the HTTP address you want to call (a controller action method).</li>
<li>formId = the id of the form that is making the call.</li>
<li>loaderId = the id of the ajax loader (optional)</li>
<li>submitId = the id of the submit button (optional)</li>
</ul>
<p>The loaderId and submitId are used to show a loading icon and hide the submit button.  This provides the nice ajax feedback and makes sure the user doesn&#8217;t click twice.</p>
<p>The destinationUrl is the same address as in the GET or POST URL.  We need to pass the formId so that the parameters can be passed.  I&#8217;ll explain at the end other ways of passing parameters.</p>
<p>8.  Create some sample php code in the controller class &#8220;MidstrideController.php&#8221;</p>
<pre class="programlisting"> <code>
<span style="color: #000000;">
[in MidstrideController.php]

public function ajaxcallAction()

//only handle ajax calls

if ($this-&gt;_request-&gt;isXmlHttpRequest())

{

//don't render the page - no view script is needed{

$this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender();

//json is the intermediate language to pass messages between the server and client

$jsonData = "";  //initialize to nothing
//get the parameter as normal

$testValue = $this-&gt;_request-&gt;getParam("test_value");

//prepare a fancy highlight response back

$jsonData =  "var highlight = dojo.animateProperty(

{

node: 'status_message',duration: 500,

properties: {

color:         { start: 'white', end: 'black' },

backgroundColor:{ start: '#fffecc', end: '#ffffff' }

}

});highlight.play();"

$this-&gt;_response-&gt;appendBody($jsonData);

}

}

</span>
</code></pre>
<p>This action method listens for the ajax called made by the javascript function.  It only deals with <strong>XmlHttpRequests (AJAX)</strong> and then sets the controller to not render anything.  The no rendering option means you don&#8217;t need to create a view (phtml) script.  Next, you just handle the form data as you would normally and prepare a JSON response to send back.  In this case, I&#8217;ve prepared a dojo animation to make a nice highlight on a status box.  In practice, you may not want to include any javascript in your controller class, as this is technically UI logic that could be in the ajax (JS) layer.  I prefer including dojo javascript because I don&#8217;t like writing javascript <img src='http://blog.midstride.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>The last call <strong>$this-&gt;_response-&gt;appendBody($jsonData)</strong> returns a javascript string which is evaluated in your javascript function by <strong>dojo.eval(data)</strong>.</p>
<h3>You&#8217;re done</h3>
<p>That&#8217;s it!  You now have a simple way of making ajax calls and keeping your main logic in the controller layer, where it should be.   If you wanted to  pass more parameters to the controller class, you would have to modify the formPost() function to have this:</p>
<blockquote><p>contentParams =  { &#8220;paramOne&#8221;:&#8221;1&#8243;,&#8221;paramTwo&#8221;:&#8221;2  };</p></blockquote>
<p>and then pass this to the var post params like:</p>
<blockquote><p>var postParams { content:contentParams, &#8230;other parameters}</p></blockquote>
<p>This can be useful when you have hidden values or other non traditional form inputs to pass in.</p>
<h3>Pros</h3>
<p>-8 steps to a reusable ajax layer.<br />
-You can easily customize the ajax post effects with dojo&#8217;s large animation library.<br />
-A very customizable and flexible framework for any project.</p>
<h3>Cons</h3>
<p>-Technical level:  It can take a while to learn the MVC and Dojo library.</p>
<h3>Conclusion</h3>
<p>That wraps up my first article on AJAX and the Zend Framework.  Future upcoming AJAX articles will discuss how to integrate Zend in scenarios where you want a real progress bar, modal popups, and captcha services.  Please let me know if you have any comments or questions.</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/share_save?sitename=Midstride%20Solutions&amp;siteurl=http%3A%2F%2Fblog.midstride.com%2F&amp;linkname=Integrating%20AJAX%2FDojo%20into%20the%20Zend%20MVC%20in%208%20steps.&amp;linkurl=http%3A%2F%2Fblog.midstride.com%2F2008%2F08%2F26%2Fintegrating-ajaxdojo-into-the-zend-mvc-in-8-steps%2F"><img src="http://blog.midstride.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Integrating AJAX/Dojo into the Zend MVC in 8 steps.";
		a2a_linkurl="http://blog.midstride.com/2008/08/26/integrating-ajaxdojo-into-the-zend-mvc-in-8-steps/";
						    </script>
    <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.midstride.com/2008/08/26/integrating-ajaxdojo-into-the-zend-mvc-in-8-steps/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Creating custom tooltips by extending Dojo&#8217;s Dijits &#8211; in 8 Steps</title>
		<link>http://blog.midstride.com/2008/08/25/creating-custom-tooltips-by-extending-dojos-dijits-in-8-steps/</link>
		<comments>http://blog.midstride.com/2008/08/25/creating-custom-tooltips-by-extending-dojos-dijits-in-8-steps/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 20:15:07 +0000</pubDate>
		<dc:creator>andre</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[dijittooltip]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[tooltip]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://blog.midstride.com/?p=5</guid>
		<description><![CDATA[Tooltips are nice small additions that can improve the user experience. They are so common that Dojo and other javascript frameworks provide precanned ways of creating them.]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p><img class="alignleft" style="float: left;" src="http://blog.midstride.com/wp-admin/resources/tooltip2.png" alt="dojo tooltip" />Tooltips are nice small additions that can improve the user experience.  They are so common that <a title="dojotoolkit" href="http://dojotoolkit.org/" target="_blank">Dojo</a> and other javascript frameworks provide precanned ways of creating them.  In dojo, they provide <a title="dojo dijit" href="http://dojotoolkit.org/projects/dijit" target="_blank">dijits</a> (their widgets) that can do some amazing things on the user interaction side.  That being said, when you want to customize them in any way, you can run into many walls.<br />
<span id="more-5"></span></p>
<p><strong>Dojo tooltip</strong><br />
<img src="http://blog.midstride.com/wp-admin/resources/tooltip.png" alt="dojo tooltip" width="90" height="30" /></p>
<h3>Problem &amp; Goal of this Article</h3>
<p>The main goal of this article is to show you how to stylize the tooltips so that you can create your own type of tooltip.  This article will go through the css required and how to structure your code so that you can create more than one tooltip.</p>
<p>To extend the style of dojo&#8217;s dijit, it&#8217;s best to copy one of the existing themes and create your own custom theme.  In this tutorial, I&#8217;ve copied the &#8220;tundra&#8221; theme so all the following css code will use the &#8220;tundra&#8221; selector.  You could replace the tundra selectors with your own custom name, but it may be more work than it&#8217;s worth.</p>
<h3>Prerequisites &#8211; tools you&#8217;ll need setup:</h3>
<ul>
<li> <a title="Firefox" href="http://www.firefox.com" target="_blank">Firefox</a><br />
<em>You should have this</em></li>
<li>IE 6 or <a href="http://www.my-debugbar.com/wiki/IETester/HomePage" target="_blank">IETester</a><br />
<em>You&#8217;ll want to make it IE6 compliant right?  Or maybe not&#8230; <img src='http://blog.midstride.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </em></li>
<li><a href="http://getfirebug.com/">Firebug</a><br />
<em> Every developer and especially UI developer should have this.</em></li>
<li><a title="dojo framework" href="http://dojotoolkit.org/" target="_blank">Dojo framework setup</a><br />
<em> Follow their <a href="http://sitepen.com/labs/guides/?guide=DojoQuickStart">documentation </a>on setting up the includes</em></li>
</ul>
<h3>The Steps</h3>
<p><strong>1. Setup a new theme</strong><br />
-Open up the dojo dijit theme folder<br />
-dojo-release-1.1.1dijitthemes<br />
<strong>2. Create a copy of the &#8220;tundra&#8221; folder.</strong><br />
<strong>3. Rename it to the name of your theme.  (e.g. &#8211;  &#8220;tundraextended&#8221;)</strong><br />
<strong>4. Include the dojo style and your extended theme in your header code:</strong></p>
<blockquote><p>&lt;style type=&#8221;text/css&#8221;&gt;<br />
@import &#8220;pathtodojo/dojo-release-1.1.1/dijit/themes/tundraextended/tundra.css&#8221;;<br />
@import &#8220;pathtodojo/dojo-release-1.1.1/dojo/resources/dojo.css&#8221;<br />
&lt;/style&gt;</p></blockquote>
<p><strong>5.  Include the tool tip dijit:</strong></p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
dojo.require(&#8220;dojo.parser&#8221;);<br />
dojo.require(&#8220;dijit.Tooltip&#8221;);<br />
&lt;/script&gt;</p></blockquote>
<p><strong>6. Add the tool tip code</strong></p>
<blockquote><p>&lt;body class=&#8221;tundra&#8221;&gt; &lt;!&#8211; you need to set the body to load the dijit styles &#8211;&gt;</p>
<p>&lt;a id=&#8221;theId&#8221; href=&#8221;#&#8221;&gt;Hover over this&lt;/a&gt;</p>
<p>&lt;div dojoType=&#8221;dijit.Tooltip&#8221; style=&#8221;display:none&#8221; position=&#8221;left&#8221; connectId=&#8221;theId&#8221;&gt;<br />
&lt;div class=&#8221;custom_tooltip&#8221;&gt;tool tip content&lt;/div&gt;<br />
&lt;/div&gt;</p></blockquote>
<p><em>Note the attribute &#8220;position=left&#8221;.  This should remain the same for all tooltips that are defined by the inner class &#8220;custom_tooltip&#8221;.  I don&#8217;t really use the position attribute and rely on css position.<br />
</em><br />
At this point you should have a simple tool tip hover when the mouse goes over the link.  If you don&#8217;t, then open up firebug and see if you have any errors.  If you do, then you most likely didn&#8217;t setup dojo properly.</p>
<p>If all is good now, then you have a nice basic tooltip.  Now, the hard part is how to extend the look:<br />
<strong>7. Create a new css file &#8211; dojoextended.css</strong><br />
This style sheet should be included last.  As its name suggests, it extends (overrides and resets) the dojo stylesheet.</p>
<blockquote><p>&lt;style type=&#8221;text/css&#8221;&gt;<br />
@import &#8220;pathtodojo/dojo-release-1.1.1/dijit/themes/tundraextended/tundra.css&#8221;;<br />
@import &#8220;pathtodojo/dojo-release-1.1.1/dojo/resources/dojo.css&#8221;<br />
<strong>@import &#8220;pathtocss/dojoextended.css&#8221;</strong><br />
&lt;/style&gt;</p></blockquote>
<p><strong>8. Add the following css to the extended css file</strong></p>
<blockquote><p>/*Reset the generic tooltip container */<br />
.tundra .dijitTooltipContainer<br />
{<br />
background:none;<br />
padding:0;<br />
margin:0;<br />
border:none;<br />
height:auto;<br />
width:auto;<br />
}</p>
<p>/*defines the div inside the tooltip &#8211; your custom tooltip*/<br />
.custom_tooltip<br />
{<br />
/*this defines your tooltip*/<br />
position:relative;<br />
left:5px; /*use left and top to position it */<br />
top:15px;<br />
width:125px;<br />
height:100px;<br />
background-image:url(&#8220;yourimage.png&#8221;);<br />
}</p>
<p>/*if your tooltip uses transparency, define a ie6 specific one below */<br />
.dj_ie6 .tundra  .custom_tooltip<br />
{<br />
background-image:url(&#8220;yourimage_ie6.png&#8221;); /*an 8-bit png*/<br />
}</p>
<p>/*hide the connector &#8211; an arrow that connects the tooltip to the hovered item */</p>
<p>.tundra  .dijitTooltipAbove .dijitTooltipConnector  { background:none; }<br />
.tundra .dijitTooltipLeft .dijitTooltipConnector { background:none; }<br />
.tundra .dijitTooltipBelow .dijitTooltipConnector { background:none; }<br />
.tundra .dijitTooltipRight .dijitTooltipConnector { background:none; }</p></blockquote>
<h3>You&#8217;re done!</h3>
<p>You can now create as many styles for your tooltips as you need by defining a specific div and a new style (e.g. &#8211; custom_tooltip2).  You will likely have to do a lot of tweaking on the positioning image, but it&#8217;s pretty straightforward when you look at it.  The longest part is determining which css selectors you need to use, if you look at the tundra.css class you&#8217;ll notice there are more selectors I didn&#8217;t look at.</p>
<h3>Pros</h3>
<p>-Quick to code.<br />
-Easy to understand, there&#8217;s only one div to deal with.<br />
-IE6 compliant.  It&#8217;s always a bonus <img src='http://blog.midstride.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
-Extendability.  You can now create as many tooltips as you want for one project.  With the standard tooltip, you would be stuck with one tooltip for an entire project.</p>
<h3>Cons</h3>
<p>-Inefficient: Resetting styles is cumbersome and requires more data to be loaded.<br />
-Upgrading dojo could break the custom tooltips if they change the way the tooltip are rendered.<br />
-Tooltipconnector: I didn&#8217;t use the tooltipconnector which allows you to position the tooltip in various positions easily.</p>
<p><strong>Conclusion<br />
</strong>That wraps up the first tutorial on dojo.   I hope you found it useful, and I appreciate all feedback.  If you have a better way, I would like to know about it.  My next article will look at how to combine dojo&#8217;s ajax with the zend framework.</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/share_save?sitename=Midstride%20Solutions&amp;siteurl=http%3A%2F%2Fblog.midstride.com%2F&amp;linkname=Creating%20custom%20tooltips%20by%20extending%20Dojo%E2%80%99s%20Dijits%20%E2%80%93%20in%208%20Steps&amp;linkurl=http%3A%2F%2Fblog.midstride.com%2F2008%2F08%2F25%2Fcreating-custom-tooltips-by-extending-dojos-dijits-in-8-steps%2F"><img src="http://blog.midstride.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">
		a2a_linkname="Creating custom tooltips by extending Dojo’s Dijits – in 8 Steps";
		a2a_linkurl="http://blog.midstride.com/2008/08/25/creating-custom-tooltips-by-extending-dojos-dijits-in-8-steps/";
						    </script>
    <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.midstride.com/2008/08/25/creating-custom-tooltips-by-extending-dojos-dijits-in-8-steps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

