Sam, thanks for the update. WIll try that.
Another question: i have extended the renderer a bit so it's now possible to fetch .twig templates from an S3 bucket (since this is where I want our customers to store their templates, and not on our servers). With the AWS SDK I can easily get the contents of the .twig templates in a variable.
Would it be possible to parse a 'template' which is in a variable (as a string) instead of using a URL? Something like:
//function renderFile in ETwigViewRenderer.php holds these lines. It needs a $sourceFile path string.
$sourceFile = substr($sourceFile, $this->_basePathLength);
$template = $this->_twig->loadTemplate($sourceFile)->render($data);
//I have the body of a twig template available (from S3) and would like to use that for parsing.
$templateBody = $s3->get_object('bucket-name',$s3SourceFile);
$template = $this->_twig->loadTemplateFromBody($templateBody)->render($data);
Currently I have no idea how I could fix this.. perhaps someone can give me a direction? Perhaps it's very simple.. don't know
With this solution we could also implement some caching (we use Elasticache from AWS) and only fetch the files when the cache is empty (which is done when the templates on S3 are updated).
Update: i can see that I can create a new loader
$loader = new Twig_Loader_String();
. However, creating a new S3 loader would be the best thing to do I guess.
This post has been edited by WouterN: 23 February 2012 - 07:55 AM