개발 예: "Hello, world" 표시


"Hello, world" 프로그래밍 예제 표시 프로그램 코드 작성 저장 디렉터리 형식:
플러그인 프로그램 저장 디렉터리: /e/extend/helloworld/
플러그인 템플릿 저장 디렉터리: /e/extend/helloworld/template/
필수 프로그램 파일:
/e/extend/helloworld/index.php 메인 프로그램 파일
/e/extend/helloworld/template/index.temp.php 메인 프로그램 템플릿 파일

프로그램 디렉토리 템플릿 디렉토리
기본 프로그램 파일 내용(/e/extend/helloworld/index.php):
<?php
require('../../class/connect.php'); //데이터베이스 구성 파일 및 공용 함수 파일 소개
require('../../class/db_sql.php'); //데이터베이스 작업 파일 소개
$link=db_connect(); //MYSQL에 연결
$empire=new mysqlquery(); //데이터베이스 작업 클래스 선언
$editor=1; //디렉토리 계층 선언

$context='Hello, World!'; //표시 콘텐츠 정의
require('template/index.temp.php'); //템플릿 파일 가져오기

db_close(); //MYSQL 링크 닫기
$empire=null; //작업 변수 취소
?>


主程序模板文件内容(/e/extend/helloworld/template/index.temp.php):
<?php
if(!define('InEmpireCMS'))
{
        종료();
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示<?=$context?>例子</title>
</head>
<body>
<br>
<br>
<br>
<테이블 width="500" border="0" 정렬="가운데" cellpadding="3" cellpacing="1" bgcolor="#CCCCCC">
  <tr>
    <td height="25"><strong>显示内容为如下:</strong></td>
  </tr>
  <tr>
    <td height="60" bgcolor="#FFFFFF"> <div align="center"><strong><font color="#FF0000" size="5"><?=$context?></font></strong></div></td>
  </tr>
</table>
</body>
</html>
说명: 模板可用Dreamweaver可视化 제조사.   访问Hello World插件文件主程序:/e/extend/helloworld/index.php