編程完純HTML/CSS/Javascript/PHP後,我剛開始使用名爲OctoberCMS的CMS,因爲Laravel框架和OctoberCMS看起來結構非常好,易於使用/維護。但是我對如何處理單個詳細信息頁面或概覽頁面感到困惑。OctoberCMS新聞列表/詳細信息頁面
讓我們以新聞頁面爲例。到目前爲止,我已將此頁:
title = "News"
url = "/news/:news_id?|^[0-9]+$"
layout = "default"
description = "This is the news page."
is_hidden = "0"
meta_title = "News"
meta_description = "News page meta description"
==
<?php
function onStart()
{
$news_id = $this->param('news_id');
if(isset($news_id)) {
$news_article = []; //get the news article by id
$this['news_article'] = $news_article;
} else {
$news = []; //get an array of news articles (last ... articles ordered by datetime desc)
$this['news'] = $news;
}
}
?>
==
<div class="container">
<h1 class="block-title">
News
</h1>
{% if news_article is defined %}
Article
{% else %}
Overview
{% endif %}
</div>
但我在哪裏實際管理作出某種書房做新聞文章?我已經閱讀了關於在新插件中創建新類的一些信息,但找不到任何有關此問題的教程或文檔,或者我只是在搜索時使用了錯誤的術語。有人可以做一個小例子(也許有新聞文章)或發佈鏈接,我可以找到一個教程/文檔?