[WordPress] 外掛分享: dbview

首頁外掛目錄 › dbview
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
100+
安裝啟用
★★★★★
5/5 分(4 則評價)
4288 天前
最後更新
問題解決
WordPress 3.0.1+ v0.5.5 上架:2012-01-14

內容簡介

這個外掛讓您可以將資料庫 SQL 查詢的結果以表格的方式呈現。您可以將這個查詢儲存為具名的視圖,並透過短代碼 [dbview name=name-of-view] 在任何文章中嵌入成為表格。視圖可以在儀表板中建立和編輯。

短代碼範例

使用頁面大小為 50 列來顯示 ‘world cities’ 視圖。
[dbview name=’world cities’ pagesize=50]

使用 ‘city’ 欄位升序排序來顯示 ‘world cities’ 視圖。
[dbview name=’world cities’ sort=city order=asc]

使用 ‘population’ 欄位降序排序來顯示 ‘world cities’ 視圖。
[dbview name=’world cities’ sort=population order=desc]

顯示人口大於 500 萬的美國地區的 ‘world cities in country’ 視圖。關於傳遞參數的問題,請參照常見問題解答。
[dbview name=’world cities in country’ sort=city order=asc pagesize=10
arg1=’United States’ arg2=5000000]

用戶功能

可以按表頭進行欄位排序,每欄位都可以啟用此功能。
頁面導航在表格底部(自 0.5.3 版開始)。
表格使用 AJAX 載入。

管理功能

每個檢視均可在儀表板的 dbview/Settings 中建立/編輯/刪除和測試。
每個簡單的檢視由一個 SQL 陳述式和與每個欄位關聯的一個可選的 PHP 碎片組成。
可以啟用和停用每個欄位的排序。
可以使用 PHP 碎片來操作每個欄位。此功能允許引入永久鏈接、圖像和其他自定義功能。
每個檢視都存儲在 wp_options 表格中的單個序列化物件中。

限制

表格沒有樣式設計,這需要您在主題中進行設計。
結果表格中的數據無法編輯。

安全性

啟用外掛後,管理員具有 ‘管理 DB 觀點’ 的能力。其他不同角色的 WP 用戶需要剛好授予那個能力才能創建/編輯視圖。只有明確標記為公用的視圖才會對非管理員和公眾可見。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.5.5) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「dbview」→ 直接安裝(推薦)

原文外掛簡介

Presents the results a database SQL query in a table. The query can be saved as a
named view which can then be embedded as a table in any post using the shortcode
[dbview name=name-of-view]. Views can be created and edited in the dashboard.
Shortcode examples
Show the ‘world cities’ view with a page size of 50 rows.
[dbview name=’world cities’ pagesize=50]
Show the ‘world cities’ view initially sorted by column ‘city’ in ascending order.
[dbview name=’world cities’ sort=city order=asc]
Show the ‘world cities’ view initially sorted by column ‘population’ in descending order.
[dbview name=’world cities’ sort=population order=desc]
Show the ‘world cities’ view without any pagination.
[dbview name=’world cities’]
Show the ‘world cities’ in the US with a population of greater than 5 million. See FAQ on passing arguments.
[dbview name=’world cities in country’ sort=city order=asc pagesize=10
arg1=’United States’ arg2=5000000]
End User Features

Column sorting on table header. Columns are enabled on each column.
Page navigation is on the table footer (from 0.5.3).
Tables are loaded using AJAX.

Management Features

Each view can be created/edited/deleted and tested under dbview/Settings in the dashboard.
Easy view consists of one SQL statement plus an optional PHP snippet associated wthe each column.
Sorting on each column can be enabled and disabled.
Each column can be manipulated using a PHP snippet. This functionality allows the introduction of permalinks, images and other customisations.
Each view is stored in a single serialized object in the wp_options table.

Limitations

Tables are not styled; this is left to the theme.
The data in the results table(s) cannot be edited.

Security
When the plugin is activated, administrators are given the capability to ‘manage DB views’.
Any other wp user with a different role that needs to create/edit views must be granted that capability.
Only a view that is explicitly checked as public will be visible to non administrators and the public.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon