FuelPHP子文件夹中的资产
问题描述:
是否可以使用资产来包含子文件夹中的文件?FuelPHP子文件夹中的资产
实施例: [BASE_URL] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css
答
烨,刚才设置的路径中asset.php任何你如:
$config['asset_paths'] = array('assets/');
这就是如果你想使用资产库。否则,只要让它们成为webroot的绝对路径。
答
您可以访问资源/文件夹的子文件夹与此:
// 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
为assets
和css_dir
为css/
,您可以使用echo Asset::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