php - Laravel 模板结构允许单独的模板文件夹?
问题描述
我有一个正常的 laravel 安装,这意味着我的刀片文件都可以在以下位置找到:
/laravel/resources/views
我想创建另一个文件夹,最好在这个位置:
/templates
并具体有:
/templates/myCustomTheme
如果我有 breadcrumb.blade.php 位于:
/laravel/resources/views/breadcrumb.blade.php
而且我还有:
/templates/myCustomTheme/breadcrumb.blade.php
然后我希望 laravel 改用后一个 myCustomTheme 面包屑文件。
关于从哪里开始做正确的任何想法?
谢谢!
解决方案
你可以使用这个包
https://github.com/石浦/themevel
由于此软件包支持许多需要多主题支持的功能
Custom theme path
Override theme
Parent theme support
Unlimited Parent view finding
Asset Finding
Theme translator support
Multiple theme config extension
Multiple theme changelog extension
Artisan console commands
Theme enable only Specific route via middleware
Almost everything customizable
Also Laravel 7.0+, 8.0+ Support
要切换当前主题,您可以根据您的要求在服务提供商或中间件中使用 set 方法
Theme::set('theme-name');
推荐阅读
- asp.net - C#:Google.Apis.Auth.OAuth2.Responses.TokenResponseException:错误:“invalid_client”,描述:“未找到 OAuth 客户端。”,Uri:“”
- mql4 - 如何检查票证是否仍处于打开状态或已关闭?
- purescript - Purescript 0.12 入门
- mongodb - 如何在 MongoDB 中为自定义在线钱包系统安全地存储信用金额
- angular - Angular 6 *ngFor 指令不起作用
- css - 如何使用 scss 选择父项
- c# - 条件绑定
- javascript - 不使用div,根据条件显示和隐藏html组件
- sas - SAS EG 中宏功能的自动参数和定义显示
- php - 警告:mysqli_num_rows() 期望参数 1 为 mysqli_result,对象在 /customers/4/8/8/web-line.dk/httpd.www/TACO/forside.php 第 19 行给出