Is it posible to use template files instead of making templates in resources-templates?
Quote from: WijbaL at Dec 24, 2006, 11:07 PM
Is it posible to use template files instead of making templates in resources-templates?
Name your template file "myTemplate.html"
Place it in "/assets/templates/myTemplate.html"
Create a template variable named "templateTV"
Make it’s input type = "file"
make it’s default value = "@FILE assets/templates/myTemplate.html"
Create a document template named "myTemplate"
Go back to the template variable and make it available to this template.
Then return to this template and set its contents to "[*templateTV*]"
Create a MODx document.
Set its template to "myTemplate".
Now you can edit your template file in Dreamweaver, etc. then upload it to /assets/templates/myTemplate.html, and when you refresh your MODx document you’ll see your changes.
Is that what you wanted?
This is a great way of easily working with several templates at once! However, something worries me a bit. I name my template files start-page.tpl, for example, and put them inside a folder named "t" in the root. I noticed that you can enter the URL of the file and see the whole content of the template unparsed (even if I were to use .html instead of .tpl, the snippet tags would be fully visible). This may be revealing a little more than I am comfortable with. Is there any way of preventing this?
Great tip! Thanks! However, this will only work with the better hosts that lets you put stuff outside the web root. I’ve got some clients that uses hosts that only allows access directly to the web root and not outside it. I’d appreciate any other suggestions regarding those cases.
Just place it outside the root of your website.
for example in directadmin you have your site here:
/home/domain/domain.ext/public_html/
Then you should place your files in
/home/domain/domain.ext/templates/
The files are then available to MODx, but they are not browsable by anyone.
which of the 2 methods is faster?
are there any drawbacks??