You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*\+ README → Документация → Описание параметров → `tpl_placeholders`: Текст улучшен.
30
40
31
41
32
42
## Версия 2.1 (2015-12-28)
43
+
33
44
*\+ Добавлен вывод типа файла (плэйсхолдер `[+type+]` при выводе через `tpl` и `type` в `output` соответственно). Удобно использовать с [Font Awesome](http://fontawesome.io/).
34
45
*\* Нулевой размер файла выводится (не считается ошибкой filesize).
35
46
*\* Сниппет `ddGetDocumentField` больше не используется, значение поля документа получается при помощи метода `ddTools::getTemplateVarOutput`.
@@ -38,6 +49,7 @@
38
49
39
50
40
51
## Версия 2.0 (2014-03-25)
52
+
41
53
*\* Сниппет переименован в `ddGetFileInfo`.
42
54
*\* Следующие параметры были переименованы:
43
55
* \* `getField` → `docField`.
@@ -53,40 +65,47 @@
53
65
54
66
55
67
## Версия 1.6.1 (2013-10-23)
68
+
56
69
*\+ Существование файла теперь проверяется через `fopen`, что позволяет работать с удалёнными файлами.
57
70
*\* Если имя файла начинается с сивола `/`, он всегда вырезается.
58
71
*\* Если размер файла получить не удалось (например, файл где-то в интернетах), плэйсхолдер `filesize` в чанке `tpl` будет содержать пустую строку.
59
72
*\* Рефакторинг.
60
73
61
74
62
75
## Версия 1.6 (2013-08-14)
76
+
63
77
*\* Внимание! Нарушена обратная совместимость.
64
78
*\+ При выводе через шаблон добавлен плэйсхолдер `[+file+]` (полный адрес файла).
65
79
*\* При выводе через шаблон плэйсхолдер `[+ext+]` переименован в `[+fileext+]` (для однообразности).
66
80
*\- Удалён параметр `getPublished` за ненадобностью.
67
81
68
82
69
83
## Версия 1.5 (2013-01-17)
84
+
70
85
*\+ Добавлена возможность передавать дополнительные (параметр `placeholders`) в чанк `tpl`.
71
86
*\* Внимание! Сниппет теперь использует библиотеку ddTools 0.4 (при использовании параметра `placeholders`).
72
87
73
88
74
89
## Версия 1.4 (2012-08-13)
90
+
75
91
*\+ При выводе через шаблон добавлены плэйсхолдеры: `[+filename+]` (имя файла), `[+filepath+]` (путь к файлу).
76
92
77
93
78
94
## Версия 1.3 (2011-06-07)
95
+
79
96
*\+ Добавлена возможность получения адреса файла из поля заданного документа (добавлены параметры `getId`, `getField`, `getPublished`).
80
97
81
98
82
99
## Версия 1.2 (2011-04-20)
100
+
83
101
*\+ Если файл получить не удалось, пробуем отрезать '/' от начала имени.
84
102
*\+ Добавлен плейсхолдер `[+ext+]`, в который записывается расширение файла при выводе через шаблон.
* If `ddGetFileInfo` is not exist on your site, `ddInstaller` will just install it.
55
33
* If `ddGetFileInfo` is already exist on your site, `ddInstaller` will check it version and update it if needed.
56
34
57
35
58
-
### Parameters description
36
+
### Manually
37
+
38
+
39
+
#### 1. Elements → Snippets: Create a new snippet with the following data
40
+
41
+
1. Snippet name: `ddGetFileInfo`.
42
+
2. Description: `<b>2.5.1</b> Displays information about a file: type, mime, size in readable format, path, name, extension, etc.`.
43
+
3. Category: `Core`.
44
+
4. Parse DocBlock: `no`.
45
+
5. Snippet code (php): Insert content of the `ddGetFileInfo_snippet.php` file from the archive.
46
+
47
+
48
+
#### 2. Elements → Manage Files
49
+
50
+
1. Create a new folder `assets/snippets/ddGetFileInfo/`.
51
+
2. Extract the archive to the folder (except `ddGetFileInfo_snippet.php`).
52
+
53
+
54
+
## Parameters description
59
55
60
56
*`file`
61
-
* Desctription: File name (path).
57
+
* Description: File name (path).
62
58
* Valid values:
63
59
* `stringFilePath` — the path to the file can be specified relative to the site root (`/` at the beginning does not matter, both variants are supported), or the full path (including `$modx->config['base_path']`)
64
60
* `stringUrl` — you can specify not only a local file, but also an Internet address, but in this case not all functions are supported for objective reasons
65
61
* **Required**
66
62
67
63
*`file_docField`
68
-
* Desctription: A document field (including TV) containing the path to the file (if you want the snippet to get the file address from the document field).
64
+
* Description: A document field (including TV) containing the path to the file (if you want the snippet to get the file address from the document field).
69
65
* Valid values: `string`
70
66
* Default value: —
71
67
72
68
*`file_docId`
73
-
* Desctription: Resource ID, from the field of which you want to get the file address.
69
+
* Description: Resource ID, from the field of which you want to get the file address.
74
70
* Valid values: `integerDocId`
75
71
* Default value: —
76
72
77
73
*`sizeUnitFormat`
78
-
* Desctription: Format of file size unit.
79
-
Values are case insensitive (the following names are equal: `'enshort'`, `'EnShort'`, `'ENSHORT'`, etc).
74
+
* Description: Format of file size unit.
75
+
* Values are case insensitive (the following names are equal: `'enshort'`, `'EnShort'`, `'ENSHORT'`, etc).
80
76
* Valid values:
81
77
* `'none'`
82
78
* `'EnShort'` — e. g. `MB`
@@ -86,12 +82,12 @@ require_once(
86
82
* Default value: `'EnShort'`
87
83
88
84
*`sizePrecision`
89
-
* Desctription: The number of decimal digits to round to.
85
+
* Description: The number of decimal digits to round to.
90
86
* Valid values: `integer`
91
87
* Default value: `2`
92
88
93
89
*`output`
94
-
* Desctription: File information to output (if `tpl` is not set).
90
+
* Description: File information to output (if `tpl` is not set).
95
91
* Valid values:
96
92
* `'size'`
97
93
* `'extension'`
@@ -102,74 +98,74 @@ require_once(
102
98
* Default value: `'size'`
103
99
104
100
*`tpl`
105
-
* Desctription: Output template (if the parameter is absent, file data corresponding to `output` will be returned).
106
-
Available placeholders:
107
-
* `[+file+]` — full file address
108
-
* `[+name+]` — file name
109
-
* `[+path+]` — file path
110
-
* `[+size+]` — file size with a unit in a human-readable format
111
-
* `[+extension+]` — file extension
112
-
* `[+type+]` — file type:
113
-
* `'archive'`
114
-
* `'image'`
115
-
* `'video'`
116
-
* `'audio'`
117
-
* `'text'`
118
-
* `'pdf'`
119
-
* `'word'`
120
-
* `'excel'`
121
-
* `'powerpoint'`
122
-
* `[+typeMime+]` — content type in MIME format (only for local files, not for URLs)
101
+
* Description: Output template (if the parameter is absent, file data corresponding to `output` will be returned).
102
+
* Available placeholders:
103
+
* `[+file+]` — full file address
104
+
* `[+name+]` — file name
105
+
* `[+path+]` — file path
106
+
* `[+size+]` — file size with a unit in a human-readable format
107
+
* `[+extension+]` — file extension
108
+
* `[+type+]` — file type:
109
+
* `'archive'`
110
+
* `'image'`
111
+
* `'video'`
112
+
* `'audio'`
113
+
* `'text'`
114
+
* `'pdf'`
115
+
* `'word'`
116
+
* `'excel'`
117
+
* `'powerpoint'`
118
+
* `[+typeMime+]` — content type in MIME format (only for local files, not for URLs)
123
119
* Valid values:
124
120
* `stringChunkName`
125
121
* `string` — use inline templates starting with `@CODE:`
0 commit comments