photo

Sławomir Żytko

shared this question
3 months ago

Employees Involved

photo

Paul Yakubets

Official Representative

Statistics

1
Comments
47
Views

Relates to

Share

Follow

1
votes

Loading javascript files through App

It is possible to load javascript file through App namespace?

I have public/assets/modules/system/js/admin.js (engine default) and I'd like to load and run file in other directory for instance public/assets/modules/test/js/test.js

Thanks.

Add Comment

Comments (1)

photo Employee
Best Response 2
In your action:

$this->view->headScript()->appendFile(

$this->view->javascriptSrc('test.js', 'test')

);

This will load public/assets/modules/test/js/test.js

Or directly from template file (it would be the most correct way):

$this->headScript()->appendFile($this->javascriptSrc('test.js', 'test'));
photo Employee
2
In your action:

$this->view->headScript()->appendFile(

$this->view->javascriptSrc('test.js', 'test')

);

This will load public/assets/modules/test/js/test.js

Or directly from template file (it would be the most correct way):

$this->headScript()->appendFile($this->javascriptSrc('test.js', 'test'));

Leave Comment

photo

Attach files...

The file must be a jpg, gif, png, bmp, ico, pdf, doc, rtf, txt, zip or rar no more than 24M