Merhabalar. Php bilgim cok mukemmel degil, yani hala ogrenme safhalarindayim. 3-4 basit site yaptikdan sonra kucuk bir sistem gelistirdim. Sizlerle paylasmak istedim. Bu sistemle sitelerinizi cok daha kolay bir sekilde yapip neyin nerde oldugunu bileceksiniz. Php ye Yeni baslayanlarin isine yarar diye dusundugum icin sizlerin kullanimina sunuyorum.
dizayn su sekilde:
test diye bir dosya olusturun. test icindeki dosyalar:
##############
index.php
config/config.php
template/default/index.php
template/default/style.css
template/default/inc/header.php
template/default/inc/footer.php
template/default/inc/top.php
template/default/images/logo.gif
template/default/functions/functions.php
###############
config/config.php
<?php
$myurl = "/test"; // tum dosyalarin oldugu dosya
$mytemplate = "default"; // kullandigimiz template dosyasi
$dbhost = "localhost"; //
$dbname = "database name"; // database ismi
$dbuser = "root"; // database kullanici ismi
$dbpass = "password"; // database sifresi
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die( "Unable to select database");
?>
index.php
<?php
$page_title = "index sayfanin basligi";
$page_keywords = "anahtar kelimeler";
$page_description = "aciklama";
define('_This_IS_not-FOR_YOU', TRUE);
include "config/config.php"; // configi getir
include "template/".$mytemplate."/functions/functions.php"; // functionslari getir
include "template/".$mytemplate."/inc/header.php"; // headeri getir
include "template/".$mytemplate."/inc/top.php"; // ust menuyu getir
include "template/".$mytemplate."/index.php"; // sayfayi getir
include "template/".$mytemplate."/inc/footer.php"; // footeri getir
?>template/default/inc/header.php
<?php defined('_This_IS_not-FOR_YOU') or die('Direct access not allowed.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?=$page_title;?></title>
<meta name="keywords" content="<?=$page_keywords;?>" />
<meta name="description" content="<?=$page_description;?>" />
<link type="text/css" rel="stylesheet" href="<?=$myurl;?>/template/<?=$mytemplate;?>/style.css">
</head>
<body>template/default/inc/top.php
<?php defined('_This_IS_not-FOR_YOU') or die('Direct access not allowed.'); ?>
<table width="800" border="1" align="center">
<tr>
<td align="center">top</td>
</tr>
</table>template/default/inc/footer.php
<?php defined('_This_IS_not-FOR_YOU') or die('Direct access not allowed.'); ?>
<table width="800" border="1" align="center">
<tr>
<td align="center">footer</td>
</tr>
</table>
</body>
</html>template/default/index.php
<?php defined('_This_IS_not-FOR_YOU') or die('Direct access not allowed.'); ?>
<table width="800" border="1" align="center">
<tr>
<td align="center">index</td>
</tr>
</table>yeni bir sayfa eklemek istiyorsaniz yapacaginiz cok kolay. diyelim help.php ekliyecegiz.
test dosyasinin icinde help.php sayfasi olusturuyoruz.
<?php
$page_title = "help sayfanin basligi";
$page_keywords = "anahtar kelimeler";
$page_description = "aciklama";
define('_This_IS_not-FOR_YOU', TRUE);
include "config/config.php"; // configi getir
include "template/".$mytemplate."/functions/functions.php"; // functionslari getir
include "template/".$mytemplate."/inc/header.php"; // headeri getir
include "template/".$mytemplate."/inc/top.php"; // ust menuyu getir
include "template/".$mytemplate."/help.php"; // sayfayi getir
include "template/".$mytemplate."/inc/footer.php"; // footeri getir
?>template/default/ icinde help.php sayfasi olusturuyoruz.
<?php defined('_This_IS_not-FOR_YOU') or die('Direct access not allowed.'); ?>
<table width="800" border="1" align="center">
<tr>
<td align="center">help</td>
</tr>
</table>bu kadar.
Bu sistemle sitenizi guncellemeniz cok kolay. Yeni bir template yaparsaniz sadece kodda bir kelimeyi degistirmeniz yetecek. umarim isinize yarar.
Bazen yazdiginiz functionlarin dizaynada etki etmesinden dolayi functions.php yi template/default/functions/ dosyasinin icine dahil ettim.