渲染組件部分從代碼按照OctoberCMS文檔this section,應該可以讓我建立這樣的目錄結構:在OctoberCMS
pluginname
├── components
│ ├── resumefilter
│ │ ├── default.htm
│ │ └── my-partial.htm
│ ├── ResumeFilter.php
│ ├── resumelist
│ │ └── default.htm
│ └── ResumeList.php
然後,我應該能夠把一個功能ResumeFilter.php
這樣的:
function onFilterResumes()
{
return ['#someDiv' => $this->renderPartial('my-partial.htm')];
}
最後,在default.htm
標記按鈕:
<button
class="btn btn-success"
data-request="onFilterResumes">
Filter
</button>
的問題是,當我按下按鈕,它說The partial 'my-partial.htm' is not found
我的完整路徑嘗試過,但它似乎並沒有任何區別。
十月似乎是在部分主題partials目錄中尋找,因爲如果我把它放在那裏,它加載。然而,在resumefilter:
前加上名稱以試圖讓它在組件中查找是行不通的,文檔似乎表明它應該在沒有前綴的組件中查找。
我發現this bug on github從2年前,但它看起來像它是固定的。
錯誤抱怨我的 - ' partial.html'這顯然不存在。你確定你使用正確的文件名嗎? – Meysam
感謝您發現@Meysam,但那只是我的錯誤。我現在更新了它。錯誤發生在javascript警報中,我無法複製/粘貼:-) – Joseph