「LiteSite/導航列」修訂間的差異
跳至導覽
跳至搜尋
(→控制首頁表現) |
|||
| 第5行: | 第5行: | ||
*網址只打 ip 或域名+路徑,不打程式名<br/>透過 site 目錄下的 index.php ,如 http://urclass.net/EMEP | *網址只打 ip 或域名+路徑,不打程式名<br/>透過 site 目錄下的 index.php ,如 http://urclass.net/EMEP | ||
<pre><?php | <pre><?php | ||
| − | if(substr(urldecode($_SERVER['SCRIPT_NAME']),strlen(urldecode($_SERVER['REQUEST_URI'])))=='index.php'){header("Location: site首頁要前往的 URI");} | + | if(substr(urldecode($_SERVER['SCRIPT_NAME']),strlen(urldecode($_SERVER['REQUEST_URI'])))=='index.php') |
| + | {header("Location: site首頁要前往的 URI");} | ||
else{ | else{ | ||
include_once '/文件根目錄/constant.php'; | include_once '/文件根目錄/constant.php'; | ||
於 2022年11月11日 (五) 15:03 的修訂
控制首頁表現
- 網址只打 ip 或域名,不打路徑
透過文件根目錄下的 index.php ,如 http://jendo.org/- 識別 $_SERVER['SERVER_NAME'] 即「jendo.org」。
- 網址只打 ip 或域名+路徑,不打程式名
透過 site 目錄下的 index.php ,如 http://urclass.net/EMEP
<?php
if(substr(urldecode($_SERVER['SCRIPT_NAME']),strlen(urldecode($_SERVER['REQUEST_URI'])))=='index.php')
{header("Location: site首頁要前往的 URI");}
else{
include_once '/文件根目錄/constant.php';
include_once 'theme.php';
if(!isset($_REQUEST['ajax'])){echo $html1;}
echo webContent(urldecode($_SERVER['REQUEST_URI']));
if(!isset($_REQUEST['ajax'])){echo $html2;}
}
?>
theme.php 會去找 webContent.webContent 資料表,其中 path 為「"/".SITE."/導航列"」的筆,如找不到會提示網站編輯者去建立此筆。