Using custom templates when calling block from php

Permalink
Hey ppl,

I'm building my first site in C5 and need some help with some code.

I'm calling the block autonav directly from the template-file (in the .php-file) with the following code:
$bt = BlockType::getByHandle('autonav');
$bt->controller->displayPages = 'top';
$bt->controller->orderBy = 'display_asc';               
$bt->controller->displaySubPages = 'none';               
$bt->render('view');


This works perfectly but I need to change the output for autonav with a custom template. I've created the template and it works great if I add a autonav-block to a page and change the template in the web interface.

But how can I use my custom template when I call the block from the template code?

Most grateful for some help!

Sorry if my english isn't great - not my first language.

// Magnus

 
ryan replied on at Permalink Reply
ryan
I believe it's:
$bt->render('templates/templatename');
// with the template's .php ommited
trippo replied on at Permalink Reply
Just got the same tip on irc and it worked perfectly.

Thanks m8!
01gaunte replied on at Permalink Reply
I was looking at that. Thank you so much!