path not found for block asset register

Permalink
I'm building a block implementing JCarousel.

I've got it all working. but I can't get it to function with the prefered method of accessing the .js file. That is registering it and requiring it.

I worked from the code in the documentation and generated this;

public function on_start(){
$al = \Concrete\Core\Asset\AssetList::getInstance();
$al->register('javascript', 'trrjcarousel', 'blocks/trr_jcarousel/jquery.jcarousel.min.js');
}

the path is right and should work from the docs but it fails to locate the file. Giving a error indicating it was looking under concrete sitename/concrete/blocks/trr_jcarousel/jquery.jcarousel.min.js

I have it working by renaming the file view.js to auto load it but of course that's not how it should be done.
any ideas why the path doesn't work?

View Replies:
marcsublet replied on at Permalink Reply
marcsublet
Hi,

you have to do it like that:

$al = \Concrete\Core\Asset\AssetList::getInstance();
$al->register('javascript', 'my_asset', 'blocks/my_block/subfolder/file.js', array(), 'my_block');
$this->requireAsset('javascript', 'my_asset');


Cheers,
marc
TRRosen replied on at Permalink Reply
That's the exact syntax I am using. Minus the option array and package handle of course. Note it's a custom block and not in a package.
Responsive replied on at Permalink Reply
Responsive
Hi , did you find a solution to this please ?