Including Block-specific JS?

Permalink
I'm familiar with the automatic method of including block-specific JS code using a "view.js" file, but what if I wanted to explicitly include a JS file with a different name that resides in my block's directory via the "addHeaderItem" method? How do I reference the JS file in my block's directory?

-Steve

Shotster
 
Shotster replied on at Permalink Reply
Shotster
Ok, if I add this to my block controller...

public function on_page_view() {
$this->addHeaderItem( '<script type="text/javascript" src=/"' . DIRNAME_BLOCKS . '/' . $this->btHandle . '/myjavascriptfile.js"></script>');
}

...it works. The question is, is it the best or most elegant way to do it, assuming I don't want to use the "view.js" automatic approach?

-Steve