請問各位,我在october cms系統上寫php不知道為什麼到網頁上就變成註解了,完全沒有辦法顯示,請問為什麼會這樣??
檔案裡的原始碼:
主題架構:
default.htm檔案
description = "Default layout"
==
<?php
function onStart()
{
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{ 'assets/css/plubic.css' |theme}}" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<title></title>
</head>
<body>
{% framework extras %}
{% scripts %}
<header class="c-header">
{% partial 'site/header' %}
</header>
<main class="c-content">
{% page %}
</main>
<footer class="c-footer">
{% partial 'site/footer' %}
</footer>
<script type="text/javascript" src="{{ 'assets/public/js/manifest.js'|theme }}"></script>
<script type="text/javascript" src="{{ 'assets/public/js/vendor.js'|theme }}"></script>
<script type="text/javascript" src="{{ 'assets/public/js/app.js'|theme }}"></script>
{% framework extras %}
{% scripts %}
</body>
</html>
index.htm檔案:
title = "Home"
url = "/"
layout = "default"
is_hidden = 0
==
<?php
function onStart()
{
}
?>
<div class="banner">
<h1>料理</h1>
</div>
<div class="cont">
{% partial 'site/tab' %}
</div>
header.htm檔案:
<div class="container">
<div class="row">
<div class="col-2">
<div class="tab">
<a href="">kubb</a>
</div>
</div>
<div class="col">
<div class="header">
<a href="">HOME</a>
<a href="">ABOUT</a>
<a href="">PORTFOLIO</a>
<a href="">SERVICES</a>
<a href="">JOURNAL</a>
<a href="">CONTACT</a>
</div>
</div>
</div>
</div>
tab.htm檔案:
<?php
use dps\food\models\Cook;
function onStart()
{
$this['posts'] = Db::table('dps_food_cook')
->select('*')
->get();
}
?>
{% for post in posts %}
<div class="cad">
<p>{{post.name}}</p>
</div>
{% endfor %}
plubic.css檔案:
.banner{
background-image:url('https://images.unsplash.com/photo-1618681462303-7a8bfebfdcca?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80');
background-position: center;
background-size: cover;
height: 1000px;
width: 100%;
}
.container{
position: absolute;
top: 0px;
padding: 0 100px;
width: 100%;
}
.header{
float: right;
}
.cont{
width: 100%;
}
.cad{
width: 300px !important;
height: 300px !important;
margin: 50px 50px;
}
footer.htm檔案是空的
php程式碼主要在tab.htm上
架構是 octobercms
在網頁上看: