mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Make SSTemplateParser work with empty templates
This commit is contained in:
parent
ce5648a700
commit
5ca97c7099
@ -3904,6 +3904,10 @@ class SSTemplateParser extends Parser {
|
||||
* @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source
|
||||
*/
|
||||
static function compileString($string, $templateName = "", $includeDebuggingComments=false) {
|
||||
if (!trim($string)) {
|
||||
$code = '';
|
||||
}
|
||||
else {
|
||||
// Construct a parser instance
|
||||
$parser = new SSTemplateParser($string);
|
||||
$parser->includeDebuggingComments = $includeDebuggingComments;
|
||||
@ -3917,6 +3921,7 @@ class SSTemplateParser extends Parser {
|
||||
|
||||
// Get the result
|
||||
$code = $result['php'];
|
||||
}
|
||||
|
||||
// Include top level debugging comments if desired
|
||||
if($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
|
||||
|
@ -892,6 +892,10 @@ class SSTemplateParser extends Parser {
|
||||
* @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source
|
||||
*/
|
||||
static function compileString($string, $templateName = "", $includeDebuggingComments=false) {
|
||||
if (!trim($string)) {
|
||||
$code = '';
|
||||
}
|
||||
else {
|
||||
// Construct a parser instance
|
||||
$parser = new SSTemplateParser($string);
|
||||
$parser->includeDebuggingComments = $includeDebuggingComments;
|
||||
@ -905,6 +909,7 @@ class SSTemplateParser extends Parser {
|
||||
|
||||
// Get the result
|
||||
$code = $result['php'];
|
||||
}
|
||||
|
||||
// Include top level debugging comments if desired
|
||||
if($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
|
||||
|
Loading…
Reference in New Issue
Block a user