<?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>Skidoosh &#187; Eclipse</title> <atom:link href="http://www.skidoosh.co.uk/category/eclipse/feed/" rel="self" type="application/rss+xml" /><link>http://www.skidoosh.co.uk</link> <description>Skidoosh - PHP, Python, Django, Ruby on Rails Web Developer in North Wales</description> <lastBuildDate>Fri, 27 May 2011 11:33:40 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>CakePHP Aptana and Eclipse PDT code completion that works</title><link>http://www.skidoosh.co.uk/php/cakephp-aptana-and-eclipse-pdt-code-completion-that-works/</link> <comments>http://www.skidoosh.co.uk/php/cakephp-aptana-and-eclipse-pdt-code-completion-that-works/#comments</comments> <pubDate>Thu, 17 Dec 2009 00:44:38 +0000</pubDate> <dc:creator>Glyn Mooney</dc:creator> <category><![CDATA[Aptana]]></category> <category><![CDATA[CakePHP]]></category> <category><![CDATA[Eclipse]]></category> <category><![CDATA[PHP]]></category><guid isPermaLink="false">http://www.skidoosh.co.uk/?p=68</guid> <description><![CDATA[A short guide on how to enable CakePHP auto completion within the Aptana Studio or Eclipse PDT IDE for Models within controllers and helpers. This actually works!]]></description> <content:encoded><![CDATA[<p>I keep seeing people asking the question &#8220;How do I get code completion to work in Aptana and Eclipse PDT?&#8221;. A lot of the time I see the Helper fix but nothing else! With a bit of fiddling I&#8217;ve finally got a complete solution <strong>that works!</strong> Here how I did it:</p><p>Follow this guide to enable the .thtml or .ctp file extentions: <a title="Setting up Eclipse to work with Cake" href="http://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-with-cake" target="_blank">Setting up Eclipse to work with Cake</a></p><p>Create a dummy file in your cake root directory with the following code:</p><div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php<br /> &nbsp; &nbsp;<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp;<span style="color: #666666; font-style: italic;">//declare and define all of the helpers</span><br /> &nbsp; &nbsp;<span style="color: #666666; font-style: italic;">//to helper enable codecompletion</span><br /> &nbsp; &nbsp;<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ajax</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AjaxHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CacheHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FormHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HtmlHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$javascript</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JavascriptHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$number</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NumberHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$session</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SessionHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TextHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TimeHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> ?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></div></div><p>Then to get the Model code completion from within controllers create an app_controller.php file in you app directory and add a dummy function with the following code:</p><div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php<br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">class</span> AppController <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dummy <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//for each of your models add a definition and declaration</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//like the ones that follow</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>User <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>Post <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> ?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></div></div><p>So with a bit of luck this will help you on your way. Thanks for reading!</p> ]]></content:encoded> <wfw:commentRss>http://www.skidoosh.co.uk/php/cakephp-aptana-and-eclipse-pdt-code-completion-that-works/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 1/6 queries in 0.166 seconds using disk: basic
Object Caching 287/287 objects using disk: basic
Content Delivery Network via N/A

Served from: www.skidoosh.co.uk @ 2012-02-06 22:01:34 -->
