Custom Block Template Controller

Permalink 1 user found helpful
Where can I put a custom controller so that it only affects one template and not all?

I'm customizing a Autonav template that needs a different controller, but I want the other templates to continue using the default controller.
If I put the modified controller in Blocks > Autonav > Templates > TemplateNameFolder
it gets ignored. It only works if I put it in Blocks > Autonav but then it will affect all templates which is not good...

What's the solution for this?
Should be simple but I'm not seeing it..

Thanks

ESKEMA
 
Steevb replied on at Permalink Reply
Steevb
What are you trying to achieve with the new controller?
ESKEMA replied on at Permalink Reply
ESKEMA
What I'm trying to achieve is not really the point.. I can make the controller work with a all my templates just fine (I'm just invoking more custom classes, nothing too drastic).
It's about the principle.. If I were to make more drastic changes to the controller that would really affect the other templates, how would I go about it? Is it possible to have different controllers for different templates? Or does the controller have to be unique?
Steevb replied on at Permalink Reply
Steevb
You do mean controller.php, not view.php?
ESKEMA replied on at Permalink Reply
ESKEMA
yes
cyandesigns replied on at Permalink Reply
Was just looking for the same answer - did you figure this out?

-cy
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Its a shame, but the only way to have a custom controller is to override the controller globally for the block type.

If you want a custom controller and a custom template, it usually makes more sense to create a completely new block type by copying from the existing block type.
cyandesigns replied on at Permalink Reply
That's disappointing - I thought I was just not putting the new controller in the right place.

Thanks for the help!
madesimplemedia replied on at Permalink Reply
madesimplemedia
Is this still the case in v8?
JohntheFish replied on at Permalink Reply
JohntheFish
Technically yes.

However, depending on your reason for modifying the block controller there could be other ways round it. For example, if a template requires a few extra edit settings, I found a way round it for my Button Nav addon http://www.concrete5.org/marketplace/addons/button-nav/... .

A new link in the edit dropdown pops up an additional edit dialog for designing buttons associated with a new block template for the autonav block (and other blocks).

Others have used dashboard pages or page attributes to connect to named blocks. Arguably not quite as convenient, but still ways of adding template specific functionality to existing block controllers.
madesimplemedia replied on at Permalink Reply
madesimplemedia
Sounds good, thanks for the info. :)