@@ -95,7 +95,7 @@ Every controller should contain at least two methods:
9595 $l_message = !$this->config['acme_demo_goodbye'] ? 'DEMO_HELLO' : 'DEMO_GOODBYE';
9696 $this->template->assign_var('DEMO_MESSAGE', $this->language->lang($l_message, $name));
9797
98- return $this->helper->render('demo_body.html', $name);
98+ return $this->helper->render('@acme_demo/ demo_body.html', $name);
9999 }
100100 }
101101
@@ -154,6 +154,31 @@ title, and the status code as its arguments. The page title defaults to an
154154empty string and the status code defaults to 200. We are using the
155155`Controller template `_ ``demo_body.html ``.
156156
157+ .. tip ::
158+
159+ When calling a template file from PHP using ``phpbb\controller\helper:render() ``
160+ template files are searched for in two places (and in this order):
161+
162+ 1. phpBB/styles/*style_name */template/
163+ 2. phpBB/ext/*all_active_extensions */styles/*style_name */template/
164+
165+ The following code will load a template that could be located in any of the
166+ above locations, i.e., in any phpBB style or active extension:
167+
168+ .. code-block :: php
169+
170+ $this->helper->render('demo_body.html', $name);
171+
172+ If you only need to load a template file from within your own extension,
173+ we recommend using the ``@vendor_extension/ `` prefix:
174+
175+ .. code-block :: php
176+
177+ $this->helper->render('@acme_demo/demo_body.html', $name);
178+
179+ It is also recommended to always use unique names for your templates to avoid possible
180+ conflicts with phpBB's templates or other extensions.
181+
157182.. note ::
158183
159184 The ``phpbb\controller\helper:render() `` method returns a Symfony
0 commit comments