CSV to SortTable is great for anyone who wants to display information from a spreadsheet on a WordPress website.
将CSV转换为SortTable的功能非常适合希望在WordPress网站上显示电子表格信息的用户。
This plugin can be used to display product catalogs, inventory lists, leaderboards or anything else that can be stored in a CSV file.
此插件可用于显示产品目录,库存清单,排行榜或可以存储在CSV文件中的任何其他内容。 p>
How To Use
使用方法 h4>
Insert a sortable table into any page or post using this shortcode:
使用此短代码将可排序表格插入任何页面或帖子: p>
[csv src=http://example.com/myfile.csv] [csv src = http://example.com/myfile.csv]
code> pre>
The result will be a beautiful, semantically-correct HTML table populated with the contents of your file.
结果将是一个漂亮的,语义正确的HTML表,其中填充了文件的内容。 p>
Optional Features
可选功能 h4>
This plugin automatically does a few things for you, all of which can be disabled:
此插件会自动为您执行一些操作,所有这些操作都可以禁用: p>
- Adds some CSS to make the table look nice.
- 添加一些CSS以使表看起来更漂亮。 li>
- Converts image file URLs into clickable image links.
- 将图像文件URL转换为可点击的图像链接。 li>
- Converts certain file URLs into clickable file-type icons (.doc, .pdf, .ppt, .xls, .zip).
- 将某些文件URL转换为可点击的文件类型图标(.doc,.pdf,.ppt,.xls,.zip)。 li>
ol>
To disable any of these features, use the disable
shortcode attribute:
要禁用任何这些功能,请使用 disable code> shortcode属性: p>[csv src=http://example.com/myfile.csv disable=css] [csv src = http://example.com/myfile.csv disable = css][csv src=http://example.com/myfile.csv disable=icons,images]
[csv src = http://example.com/myfile.csv disable = icons,images]
[csv src=http://example.com/myfile.csv disable=all]
[csv src = http://example.com/myfile.csv disable = all]
code> pre>
The first example would disable only the plugin CSS;
第一个示例将仅禁用插件CSS;
the second would disable both the file-type icons and image links;
第二个将禁用文件类型图标和图像链接;
and the third would disable all optional features.
第三个将禁用所有可选功能。
Disable any combination using a comma-separated list (no spaces!).
使用逗号分隔的列表禁用任何组合(不能使用空格!)。 p>
Table ID
表格ID h4>
Want to give your table a unique ID?
是否要为您的表提供唯一的ID?
Use the id
shortcode attribute:
使用 id code>简码属性: p>[csv src=http://example.com/myfile.csv id=my_data_table] [csv src = http://example.com/myfile.csv id = my_data_table]
code> pre>
The above example would give the element an id
attribute of my_data_table
.上面的示例将为 code>元素赋予 my_data_table code>的 id code>属性。 p>Group Classes
小组课程 h4>
Let’s say you have a table with three columns: Item, Description and Type.
假设您有一个包含三列的表格:项目,说明和类型。
You want all table rows of the same Type to have the same class, so you can highlight them in different colors using CSS or modify them all at once with JavaScript.
您希望同一类型的所有表行都具有相同的类,因此您可以使用CSS以不同的颜色突出显示它们,或使用JavaScript一次修改它们。 p>
This can be done by assigning a column number to the group
shortcode attribute:
这可以通过将列号分配给 group code> shortcode属性来完成: p>[csv src=http://example.com/myfile.csv group=3] [csv src = http://example.com/myfile.csv group = 3]
code> pre>
The result would be a special class assigned to each table row based on the value of the third column.
结果将是根据第三列的值分配给每个表行的特殊类。 p>
Sorting Options
排序选项 h4>
By default, table data is sorted alphabetically.
默认情况下,表数据按字母顺序排序。
If you want to sort columns numerically or as dates, or disable sorting on certain columns, use the following shortcode attributes:
如果要按数字或日期对列进行排序,或者要禁用某些列的排序,请使用以下shortcode属性: p>
[csv src=http://example.com/myfile.csv number=2] [csv src = http://example.com/myfile.csv编号= 2][csv src=http://example.com/myfile.csv date=3]
[csv src = http://example.com/myfile.csv date = 3]
[csv src=http://example.com/myfile.csv unsortable=4,5,6]
[csv src = http://example.com/myfile.csv unsortable = 4、5、6]
code> pre>
The values can be a single column number, or multiple column numbers in a comma-separated list (no spaces!).
值可以是单个列号,也可以是逗号分隔列表中的多个列号(无空格!)。 p>
Relative File Paths
相对文件路径 h4>
If the src
value is a relative path (beginning with a forward slash), the plugin will refer to the “Site address (URL)” defined in WP-Admin > Settings >如果 src code>值是相对路径(以正斜杠开头),则插件将引用 WP-Admin>设置>中定义的“站点地址(URL)”。General
:
常规 code>: p>
[csv src=/mydata/data.csv] [csv src = / mydata / data.csv]
code> pre>
The above example would refer to http://example.com/mydata/data.csv
.
上面的示例将引用 http://example.com/mydata/data.csv code>。 p>Data Array Filter
数据数组过滤器 h4>
You may want to manipulate the CSV data after it is imported, but before the HTML table is rendered.
在导入CSV数据之后但呈现HTML表之前,您可能需要操作CSV数据。
To do so, use this filter:
为此,请使用以下过滤器: p>
csv_to_sorttable_data_array csv_to_sorttable_data_array
code> pre>
Here are some code examples of how to use the data array filter:
以下是一些有关如何使用数据数组过滤器的代码示例: p>
- Remove First Row (Function)
- 删除第一行(功能) li>
- Add a Header Row (Function)
- 添加标题行(函数) li>
- Add a Header Row (Plugin)
- 添加标题行(插件) li>
ol>
Credits
积分 h3>
This plugin utilizes some excellent open source scripts, functions and images whose creators deserve to be recognized.
此插件利用了一些优秀的开源脚本,功能和图像,其创建者值得认可。 p>
- Stuart Langridge wrote sorttable.js, the JavaScript that inspired this plugin and makes
- Stuart Langridge编写了 sorttable.js ,该JavaScript启发了该插件并
it possible to sort tables by clicking on the column headers.
可以通过单击列标题对表进行排序。 li>
- V.Krishn wrote a handy PHP function that enables users of PHP < 5.3 to utilize the
- V.Krishn编写了一个方便的 PHP函数,该函数使PHP <5.3的用户能够使用
>str_getcsv()
function that powers this plugin.为该插件供电的> str_getcsv() code>函数。 li>
- Blake Knight created the beautiful file type
- Blake Knight创建了漂亮的文件类型
icons
used in this plugin and made them free for all. 图标
在该插件中使用,并免费提供给所有人。 li> ol>
-EOF-
AI助手支持GPT4.0