3

是否可以使用资产来包含子文件夹中的文件?

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

4

3 回答 3

3

您可以使用以下命令访问 assets/ 文件夹的子文件夹:

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

// Image in /assets/subfolder/img2.jpg
print Asset::img("subfolder/img2.jpg");
于 2011-09-09T07:27:14.093 回答
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为 beassetscss_dirto 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');

于 2011-09-10T22:01:04.817 回答
0

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

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

也就是说,如果您想使用资产库。否则,只需将它们设为来自 webroot 的绝对路径。

于 2011-06-13T18:41:25.750 回答