views:

31

answers:

3

I'm using pyrocms to develop a system.

I know that, to include style links in header tag '' in a page is by using $this->template->set_metadata().

But how can I include javascript links like that?

Any answer is appreciated.

+1  A: 

If you are creating a template you can do it like this:

{js('file.js', 'modulename')}

See the Pyro documentation.

If this is not the answer you are looking for, please explain more clearly what you want. E.g. in which file exactly do you want to include your javascript?

captaintokyo
Thank you captaintokyo! Very helpful!
Hafizul Amri
+1  A: 

Alternatively, if this is for a theme and the script is housed within your actual theme/js folder, it becomes:

{theme_js('file.js')}

Using just the {js} function would send it to the actual system's embedded js files.

James Norman
+1  A: 

$this->template->append_metadata(js('foo.js)) will work, or you can dump it into the view as others have suggested.

Phil Sturgeon