Closed mindyk closed 10 years ago
but the possibility to reach for nested folders like this is not documented.
You're right, it's sort of assumed. What you're doing here is totally fine.
You can use folders if you want to "namespace" your templates. Here is something that I posted on Reddit yesterday about namespaces:
More importantly, what I was going for with the namespaces is actually the ability to decouple the filesystem from the templates as much as possible. Using syntax like
emails::welcome
allows you to define your email directory once (ie. in your bootstrap), making it really easy to change later if necessary. Hard coding folders means you have to update every template reference.
So, if you wanted, you could add a namespace for your registration views, like this:
$plates->addFolder('registration', 'path/to/templates/registration');
The, you could render it like this:
$template->render('registration::index');
Using nested folders or namespaces are both acceptable approaches and both will work. It's really comes down to how you prefer to organize your application. Myself, I tend to only namespace different sections of my applications. For example, here are some common namespaces I use:
app
admin
emails
Hope that helps.
Thx for the answer.
my default template dir is
and my template structure looks like
as i cant imagine that using the "addFolder()" function is intented here i am doing this in my ctrl
but the possibility to reach for nested folders like this is not documented. So am i using it as intented or should the render function restrict me from reaching deeper into the path
thx for your hard work