How to deliver a new template file in an PageController-Extension

Silverstripe 4

I have extended PageController via an extension. The controller should now use another template-file for rendering.

renderWith may do the trick. But I don’t know how to use it in the right way

Thanks in advance.

This should start you off:

$data= [
		'YourVariable' => 'Hello world',

	return $this->owner->customise($data)->renderWith('YourPageTemplate');

Hej thank you jellygnite,

but where do I have to put that statement?

Instead of using templates/Layout/
I want to use a diffrent one i.e. MyExtension/templates/Layout/

IS this not possible?

I found out that index is the function where the renderWith magic should be placed. Now another question appears. I just want to deliver the sub-template which is added by the $Layout-variable. Now when using renderwith it only takes the first parameter given as the main-template. It uses the same template to render $Layout aswell. So I m getting the complete Page rendered to Layout, too!!
How can I tell renderWith, to use the given template as subtemplate for

class OrderProfileFeature_ProductController extends DataExtension{
public function index(HTTPRequest $request){
return $this->getOwner()->renderWith([ThemeResourceLoader::inst()->findTemplate(