url when using alternate template
Permalink
I'm trying to create a new template for a block. I created a new folder called templates in the block folder, created a folder with the template name then copied the view.php into the folder... only problem is the view.php file is breaking because it's not pointing to the "root" anymore.
so using now points to /packages/addon/blocks/addon/templates/newtemplate instead of /packages/addon/blocks/addon
I'm sure there's a simple way to point the new template to the block root, just don't know how. thanks
so using
$baseURL = $bvt -> getBaseURL ();
I'm sure there's a simple way to point the new template to the block root, just don't know how. thanks
Sorry to be vague... I'm using the Media Library addon. I wanted to create a custom template to display videos differently then the main (only) view.php so I made a templates folder in the block folder and copied the original view.php from the block into templates/newtemplate folder
but the original view.php uses the above code (getBaseURL) so the block won't load the videos (and I assume is not loading the flash player) because the new template view is no longer in the block folder, but two layers deeper (instead of block/view.php it's block/tempates/newtemplate/view.php) so I was hoping there was a simple way to point the new view.php back to the addon root so it picks up the js and flash correctly...
does that make any more sense?
but the original view.php uses the above code (getBaseURL) so the block won't load the videos (and I assume is not loading the flash player) because the new template view is no longer in the block folder, but two layers deeper (instead of block/view.php it's block/tempates/newtemplate/view.php) so I was hoping there was a simple way to point the new view.php back to the addon root so it picks up the js and flash correctly...
does that make any more sense?
Hmm... that's a paid addon so I can't see the code. Did you try asking the developer for support on this?
Off the top of my head, you want might try using the getBlockURL() method of the BlockView instead of the getBaseURL of the BlockViewTemplate. Not sure how this fits in with the existing code, but I use this in my block controllers often:
And if that doesn't work you can always cheat and just hardcode the path to your block:
-Jordan
Off the top of my head, you want might try using the getBlockURL() method of the BlockView instead of the getBaseURL of the BlockViewTemplate. Not sure how this fits in with the existing code, but I use this in my block controllers often:
$bv = new BlockView(); $bv->setBlockObject($this->getBlockObject()); $blockURL = $bv->getBlockURL();
And if that doesn't work you can always cheat and just hardcode the path to your block:
DIR_REL . '/blocks/media_library/templates/newtemplate/style.css
-Jordan
And what exact URL are you trying to get? (The root to the original block directory? Or the root to the overridden template?)