內容簡介
這是一款 WordPress 外掛程式,可將 CSV 檔案以 DataTable 的方式呈現。此外掛會匯入 CSV 檔案的資料,並顯示在 DataTable 中。
使用方法
在任何一個頁面或文章中插入以下程式碼片段,使用這個簡碼,請確認您使用的是唯一的 id:
[aj-csv2dt src=http://e-innoving.com/samples/SacramentocrimeJanuary2006.csv id=datatable_id]
這個最近的 1.1 版本可以禁用 DataTable 的搜尋、分頁、排序和顯示 bInfo。這樣做的目的是將 CSV 檔案轉換成靜態頁面的 HTML 表格。
[aj-csv2dt src=http://e-innoving.com/samples/SacramentocrimeJanuary2006.csv id=datatable_id disable_search=true disable_paging=true disable_binfo=true disable_sorting=true]
儲存之後,就可以輕鬆地將所有 CSV 資料顯示在 DataTable 中。
感謝
這個外掛程式使用了一些優秀的開源腳本、函數和圖像,其創作者應得到認可。
Shaun Scovil,因他的 CSV to Sortable Plugin 啟發了我。
V.Krishn 撰寫了一個方便的 PHP function,使得 PHP < 5.3 的使用者能夠使用這款外掛程式所使用的 str_getcsv() function。
常見錯誤
如果 DataTable 的表現不佳,可能是因為 CSV 格式錯誤。在這種情況下,請在 Excel 中打開 CSV 檔案,並另存一個新的 CSV 檔案。這樣做很可能可以解決您的問題。
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
WordPress Plugin to present a CSV file in a DataTable. This will import data from a CSV file and display in a DataTable.
How To Use
Insert following code snippet into any page or post using this shortcode, make sure you use an unique id :
[aj-csv2dt src=http://e-innoving.com/samples/SacramentocrimeJanuary2006.csv id=datatable_id]
You can now disable DataTable search, pagination, sorting and displaying of bInfo with the recent 1.1 release. The purpose of this is to render a static looking HTML Table out of a CSV file.
[aj-csv2dt src=http://e-innoving.com/samples/SacramentocrimeJanuary2006.csv id=datatable_id disable_search=true disable_paging=true disable_binfo=true disable_sorting=true]
Save it, just refresh the page and see. Less hassle, all your csv data is inside the DataTable.
Credits
This plugin utilizes some excellent open source scripts, functions and images whose creators deserve to be recognized.
Shaun Scovil, for inspiring me through his CSV to Sortable Plugin.
V.Krishn wrote a handy PHP function that enables users of PHP < 5.3 to utilize the str_getcsv() function that powers this plugin.
Common Errors
If the datatable misbehaves, this is probably due to an incorrect csv format. In that case, open csv file in excel
and re-save it as a new csv. Most likely this will resolve your issue.
