继续Drupal分享精神 QQ群:107748121 站长QQ:2275288328 skype: hellodrupal【drupal交流+drupal 建站+theme制作】
登录 注册

drupal imce 自定义文件路径目录结构

以User-1 为例
在默认说明下提供了
Directory path

x: php: return 'users/'.$user->name; defines users/USER-NAME as the directory path.
A multi-level directory example php: return date('Y', $user->created).'/'.date('m', $user->created).'/'.$user->uid; defines MEMBERSHIP-YEAR/MONTH/USER-ID as the directory path, resulting in self-categorized user directories based on membership date.

sites/default/files/ 存放文件的路径
Including subdirectories 包括子目录选上

默认是一个.符号
系统提供了一个简单的例子和说明
比如:php: return 'users/'.$user->name (在右边表单填写)当上传文件的时候会自动建立
users/user-name 这样的文件目录。如果用户名是admin 那目录就是users/admin
多级目录php例子:
php: return date('Y', $user->created).'/'.date('m', $user->created).'/'.$user->uid; (都是以php:开始,以;结束。)
这是根据用户的注册时间,格式化时间格式来创建目录
返回的文件路径: sites/default/files/2010/2/1 这样的结构。 1 = 用户id编号

如果根据当前时间自动建立目录呢。
可以这样修改
php: return date('Y', time()).'/'.date('m', time());
返回的是当前时间格式目录路径
返回的是 sites/default/files/2010/2 这样的。总体来自定义很方便。

评论

你还真是勤奋呢,把学习过程中的一点一滴都记录下来了:-)

你还真是勤奋呢,把学习过程中的一点一滴都记录下来了:-)

匆匆扫了一遍文章标题,基本我都知道,以后多交流,呵。

http://mengxy.net

我有问题想请教你,是有关imagecache的~,怎么联系

我有问题想请教你,是有关imagecache的~,怎么联系你呢。

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.