是否可以使用资产来包含子文件夹中的文件?
示例:[base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css
是否可以使用资产来包含子文件夹中的文件?
示例:[base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css
您可以使用以下命令访问 assets/ 文件夹的子文件夹:
// Image in /assets/img1.jpg
print Asset::img("img1.png");
// Image in /assets/subfolder/img2.jpg
print Asset::img("subfolder/img2.jpg");
在./fuel/core/config/asset.php
中,您可以更改以下代码:
/**
* An array of paths that will be searched for assets. Each asset is a
* RELATIVE path from the base_url WITH a trailing slash:
*
* array('assets/')
*/
'paths' => array(''),
和
/**
* Asset Sub-folders
*
* Names for the img, js and css folders (inside the asset path).
*
* Examples:
*
* img/
* js/
* css/
*
* This MUST include the trailing slash ('/')
*/
'img_dir' => 'img/',
'js_dir' => 'js/',
'css_dir' => 'css/'
如果您配置paths
为 beassets
和css_dir
to be css/
,您可以[base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css
通过使用包含echo Asset::css('pepper-grinder/jquery-ui-1.8.11.custom.min.css');
是的,您只需将asset.php 中的路径设置为您喜欢的任何内容:
$config['asset_paths'] = array('assets/');
也就是说,如果您想使用资产库。否则,只需将它们设为来自 webroot 的绝对路径。