Setting Default Block Views

Permalink 1 user found helpful
I'm curious,
I'd like to make a block that contains several templates for my custom block.

The question is, how can I render from the templates folder by default instead of having duplicate files for certain things.

For example, how can I have two templates for my block, but the second template pulls its view.php from the first template since the only thing that changes is the css.

View Replies: View Best Answer
ob7dev replied on at Permalink Best Answer Reply
You can set the default view to be one of the templates in your templates folder by setting it in the block controllers view method:
... it appears you need to register the css manually though this way. You still need a view.php file in the block root and in the template folders but it can be blank with nothing more than the c5_execute statement.
c5dragon replied on at Permalink Reply
The only problem with this is you can't switch templates anymore.

namespace Application\Block\Autonav;
use Concrete\Block\Autonav\Controller as AutonavBlockController;
class Controller extends AutonavBlockController
    public function view()
       //set default view template 
ob7dev replied on at Permalink Reply
Indeed, unless you do something like what I did here: