How to include a blade.php template file
When you develop a plugin or change the Laravel blade template, you definitely need to call anther blade file. How to do that?
First, you need to make sure what is the frontent_dir & backend_dir template. You can find it on the settings page:
Include a blade.php template file from frontend example:
@include($helper->bladePath('includes.breadcrumb'))
Include a blade.php template file from backend example:
@include($helper->bladePath('includes.form-input','backend'), ['name' =>"title"])
Include a blade.php template file from plugins example:
return view($this->helper->bladePath('page-tab-inquiry-form.frontend-form-001'), 'plugins'), $data);
Source code of bladePath()
public function bladePath($file, $dir = 'frontend')
{
if ('frontend' == $dir || 'f' == $dir) {
return 'laravel-cms::'.$this->s('template.frontend_dir').'.'.$file;
} elseif ('backend' == $dir || 'b' == $dir) {
return 'laravel-cms::'.$this->s('template.backend_dir').'.'.$file;
} elseif ('plugins' == $dir || 'p' == $dir || 'plugin' == $dir) {
return 'laravel-cms::plugins.'.$file;
} elseif ('other' == $dir) {
return 'laravel-cms::'.$file;
} else {
return 'laravel-cms::'.$dir.'.'.$file;
}
}