I want to save my blade
templates to database, because the header and footer
of each page is customizable
for the user. I want to let
I realised that I can improve security and caching if I just let them insert the static content only. The only thing I need to change is the main content, so I can just let them set a token
where the content is to be placed. As is in the above answer by @huzaib-shafi , I did the following...
//In controller
$content = View::make('final',compact('data'));
$token = "", $content, $templateInDatabase);
$view = str_replace_first("<%token%>", $token, $view);
$view = str_replace_first("<%scripts%>", $scripts, $view);
return $view;
This enforces them to use bootstrap
in their template, because I use bootstrap styles
in my blade
templates, but it is acceptable in my case.