-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template includes #73
Comments
The node side of twig.js (path) already has an implementation for this, where you can pass a 'base' option to twig.js, I'll update the browser side (url) to also check for the 'base' option and include relative to that if it's present. |
You can now set a 'base' path when rendering a template from a browser like this:
templates/a/child.twig
This will correctly pull in the parent template from twig({
base: 'templates',
href: 'templates/a/child.twig',
load: function(template) {
var output = template.render();
}
}); This change will be in the 0.6 tagged release, which I'll get up tomorrow. |
Looks like it was fixed in 0.6. |
the PHP implementation does not allow relative includes, yet I cannot seem to get the JS version to do anything but relative includes. If I am rendering a template that is in a sub-folder, and it is trying to include a template that is in a sub-folder at the same level, how would I go about this.
Is there someway I could avoid it running the relativePath function, and instead check if it starts with a '/' making it an absolute path?
The text was updated successfully, but these errors were encountered: