Skip to content

Instantly share code, notes, and snippets.

@sniper7kills
Last active August 29, 2015 14:21
Show Gist options
  • Save sniper7kills/56b48d339f413050d3b0 to your computer and use it in GitHub Desktop.
Save sniper7kills/56b48d339f413050d3b0 to your computer and use it in GitHub Desktop.
Simple Blade Extention to render a blade into a single line. Usefull for appending a view using Javascript
Blade::extend(function($view, $compiler) {
$pattern = $compiler->createOpenMatcher('oneLine');
$page="Default";
if (preg_match_all($pattern, $view,$result)){
foreach($result[2] as $match){
$param = trim(trim($match, '(\'\')'));
$page = View::make($param)->render();
$page = implode(" ", explode("\n", $page));
$view = preg_replace($pattern, $page, $view);
}
}
return $view;
});
@sniper7kills
Copy link
Author

Still under Development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment