我是TYPO3的初學者,不得不說它非常複雜,但我正在努力通過。如何在TYPO3中獲取內部數據庫/表格內容並通過JavaScript,JQuery或AJAX顯示
我只想要一個簡單的方法從我創建的內部TYPO3數據庫表中獲取內容並將其轉發給JavaScript/JQuery/AJAX。
My BootstrapTable正在工作,但僅顯示來自var data
的靜態內容。
我知道有來自pageType,eID和$GLOBALS['TYPO3_DB']->exec_SELECTgetRows(/* ... */);
的方法來獲取數據庫表的內容,但是如何將其轉發到JavaScript並顯示它?
不應該有另一個數據庫調用憑證,只是內部數據庫的一種方式。
尋找這個答案自2天以來,但找不到任何簡單和合理的答案。 還是必須通過eID或pageType走長路?
編輯因發表評論:
這裏是我的JavaScript與bootstrapTable:
$(function() {
$('#table').bootstrapTable({
idField: 'name',
pagination: true,
search: true,
data: data,
columns: [{
field: 'name',
title: 'Name'
}, {
field: 'stargazers_count',
title: 'Stars'
}, {
field: 'forks_count',
title: 'Forks'
}, {
field: 'description',
title: 'Description'
}],
onPostBody: function() {
$('#table').editableTableWidget({editor: $('<textarea>')});
}
});
});
var data = [{
"name": "bootstrap-table",
"stargazers_count": "526",
"forks_count": "122",
"description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3) "
}, {
"name": "multiple-select",
"stargazers_count": "288",
"forks_count": "150",
"description": "A jQuery plugin to select multiple elements with checkboxes :)"
}, {
"name": "bootstrap-show-password",
"stargazers_count": "32",
"forks_count": "11",
"description": "Show/hide password plugin for twitter bootstrap."
}, {
"name": "blog",
"stargazers_count": "13",
"forks_count": "4",
"description": "my blog"
}, {
"name": "scutech-redmine",
"stargazers_count": "6",
"forks_count": "3",
"description": "Redmine notification tools for chrome extension."
}
];
而且與調用它在我的html:<table id="table"></table>
我自己在MySQL數據庫中創建表:tx_table
我希望該表的內容顯示在我的可引導表中
需要更多信息。有兩種方法可以進入前端。輸出到html中的腳本標記。使用自定義路線通過ajax獲取它。你可以使用[vhs:EncodeViewHelper](https://fluidtypo3.org/viewhelpers/vhs/master/Format/Json/EncodeViewHelper.html)從php對象創建一個json。 –
你好安德魯, 我編輯我的問題,希望它現在更清楚了 – verklixt