子文件夹中的FuelPHP资产

时间:2011-06-12 22:06:34

标签: fuelphp

是否可以使用Assets包含子文件夹中的文件?

实施例: [base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css

3 个答案:

答案 0 :(得分:3)

您可以使用以下方式访问资产/文件夹的子文件夹:

// Image in /assets/img1.jpg
print Asset::img("img1.png"); 

// Image in /assets/subfolder/img2.jpg
print Asset::img("subfolder/img2.jpg");

答案 1 :(得分:2)

./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配置为assetscss_dir配置为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'); >

答案 2 :(得分:0)

是的,您只需将asset.php中的路径设置为您喜欢的路径:

$config['asset_paths'] = array('assets/');

即如果您想使用资产库。否则只需从webroot创建它们的绝对路径。