子文件夹中的FuelPHP资产

问题描述

| 是否可以使用Assets包含子文件夹中的文件? 例: [base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css     

解决方法

        您可以使用以下方法访问资产/文件夹的子文件夹:
// 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/
,则可以通过使用ѭ9include将
[base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css
包括在内。     ,        是的,您只需将asset.php中的路径设置为您喜欢的任何路径:
$config[\'asset_paths\'] = array(\'assets/\');
也就是说,如果您想使用资产库。否则,仅使它们成为来自webroot的绝对路径。