Search code examples
phphtml-helperlithium

lithium add an external js file to view


in cake we use

$this->html->script('jsfilenamewithdotjs');

to add an external js file to a view How'd we do that with lithium


Solution

  • echo $this->html->script('jquery.js'); returns a <script /> tag. If the filename is prefixed with "/", the path will be relative to the base path of your application. Otherwise, the path will be relative to your JavaScript path, usually webroot/js.

    For an external script $this->html->script('http://foo.com/bar.js');

    Docs: http://li3.me/docs/lithium/template/helper/Html::script()