Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you are developing this 'vendor' package yourself, you should not develop it as a 'vendor', but as a plugin.</p> <p>The vendor folders are meant for including third-party libraries that are not developed with CakePHP in mind (for example to use parts of the Zend Framework in your application).</p> <p>From the <a href="http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#loading-classes" rel="nofollow">manual</a>:</p> <blockquote> <p>Note: Loading vendors usually means you are loading packages that do not follow conventions. For most vendor packages using App::import() is recommended.</p> </blockquote> <h2>Create a <em>plugin</em> not a <em>vendor</em></h2> <p>To develop re-usable code that can be used with different projects/applications, develop your code as a <strong>Plugin</strong>. Plugins are basically 'mini CakePHP applications'. Classes from a plugin can be used inside your application and vice-versa; a plugin can use CakePHP helpers the same way as you use them in your application.</p> <p>See <a href="http://book.cakephp.org/2.0/en/plugins.html#creating-your-own-plugins" rel="nofollow">Creating Your Own Plugins</a></p> <h2>Regarding the JsHelper</h2> <p>Contrary to the comment placed by Sam Delaney, your usage of the JsHelper looks fine to me. Adding some script to the Js buffer to output it in the layout seems useful. Just don't try to use it for <em>extended blocks of JavaScript</em>; that should be put in external .js files.</p> <p>I <em>do recommend</em> to write the JavaScript <em>code</em> yourself and not have the JsHelper <em>generate</em> the code for you (e.g. Don't use <code>$this-&gt;Js-&gt;get('#foo')-&gt;event('click', $eventCode);</code>). This may be personal, but IMO this makes it harder to track/debug your JavaScript and isn't any more readable than just <code>$('#foo').click('event code');</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload