get block path from within block controller
Permalink
Is it possible to get the block path from the blocks controller?
basicly need something like below, however i get an error.
Error
I haven't asked it to run getPackageID any were. I assume it is in the Blocks class
basicly need something like below, however i get an error.
$layout_dir = Block::getBlockPath() . '/layouts/';
Error
Fatal error: Call to undefined method Slickslider2BlockController::getPackageID()
I haven't asked it to run getPackageID any were. I assume it is in the Blocks class
If you can explain a bit more about your overall objective, there could be a better way to do it.
trying to get the files within the folder layouts, that is within the block folder
I think we have already gathered that. Please explain further so we have the big picture.
well that's all I want to do lol, what is it you want to know?
Sometimes if a developer is doing something that is difficult within the existing api, its because the overall way things are structured in what they are doing is inappropriate. Along the lines of the driver who stops to ask directions and gets the answer "Well, I wouldn't start from here".
How would you suggest I get the files within a folder then, If there is another way that would be great.
If you were going to use it in the view.php you could use