「LiteSite/導航列」修訂間的差異
跳至導覽
跳至搜尋
(→控制首頁表現) |
|||
| 第1行: | 第1行: | ||
[[分類:LiteSite]] | [[分類:LiteSite]] | ||
| − | ==控制首頁表現== | + | ==「頁」表現的底層機制== |
| + | ===PHP webContent(URI中 SCRIPT_NAME 之後的字串)函式=== | ||
| + | 如:「/study/info.php/ABC/DEF?A=123」中的「/ABC/DEF?A=123」 | ||
| + | |||
| + | 回傳 wiki導出頁 或 webContent表中相應的webContent欄值(簡稱:內容頁) | ||
| + | |||
| + | 包含 webContent(…) 函式的程式可以對上述字串進一步處理: | ||
| + | #/webContent.php:單純 echo 回應字串 | ||
| + | #* | ||
| + | ===控制首頁表現=== | ||
*網址只打 ip 或域名,不打路徑<br/>透過文件根目錄下的 index.php ,如 http://jendo.org/ | *網址只打 ip 或域名,不打路徑<br/>透過文件根目錄下的 index.php ,如 http://jendo.org/ | ||
*:識別 $_SERVER['SERVER_NAME'] 即「jendo.org」。 | *:識別 $_SERVER['SERVER_NAME'] 即「jendo.org」。 | ||
於 2022年11月15日 (二) 11:18 的修訂
「頁」表現的底層機制
PHP webContent(URI中 SCRIPT_NAME 之後的字串)函式
如:「/study/info.php/ABC/DEF?A=123」中的「/ABC/DEF?A=123」
回傳 wiki導出頁 或 webContent表中相應的webContent欄值(簡稱:內容頁)
包含 webContent(…) 函式的程式可以對上述字串進一步處理:
- /webContent.php:單純 echo 回應字串
控制首頁表現
- 網址只打 ip 或域名,不打路徑
透過文件根目錄下的 index.php ,如 http://jendo.org/- 識別 $_SERVER['SERVER_NAME'] 即「jendo.org」。
- 網址只打 ip 或域名+路徑,不打程式名
- 1.透過 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;}
}
?>
- 2.在 site 目錄下的 index.php 中不指定跳往何方,而在表 webContent 中的 path 欄指定 SITE 路徑,如「/EMEP/20220124/」。此時「域名+路徑」只能導向內容頁。 site 目錄下的 index.php ,可以簡化如下:
<?php
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;}
?>
控制跨 site 的內容頁
- 在表 webContent 中
- path 欄值為「/webContent.php/頁名」
- webContent 欄值可以跨 site 顯示。
- webContent 欄值若含 <a href='#' onClick="webContent(URI,'content');return false;">連結提示</a> 。利用 theme.php 中 javascript 的 webContent 函式,秀出任何 URI 能表達的內容。點擊連結則 a 所參照的內容就會秀出在 id 為 content 的標籤中。但無法回到上一頁。
- 在導航列中以「*#[[[頁名]]],頁名提示」來製作二級選項,此選項指向「/webContent.php/頁名」
theme.php 會去找 webContent.webContent 資料表,其中 path 為「"/".SITE."/導航列"」的筆,如找不到會提示網站編輯者去建立此筆。