-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
I already posted this here a month ago: http://laravel.io/forum/05-20-2014-example-blade-extension-from-docs-does-not-work
This triggers a fatal error
Blade::extend(function($view, $compiler)
{
$pattern = $compiler->createMatcher('datetime');
return preg_replace($pattern, '$1<?php echo $2->format('m/d/Y H:i'); ?>', $view);
});
syntax error, unexpected 'm' (T_STRING)
Obviously fixed by changing:
'$1<?php echo $2->format('m/d/Y H:i'); ?>'
to
'$1<?php echo $2->format(\'m/d/Y H:i\'); ?>'
But then:
<?php $c = Carbon::now(); ?>
<?php echo ($c)->format('m/d/Y H:i'); ?>
Symfony \ Component \ Debug \ Exception \ FatalErrorException
syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';'
Metadata
Metadata
Assignees
Labels
No labels