|
|
|
| допустим есть index.php..
самые простейшие способы подключение в шаблон модулей...
<table width="200" border="1">
<tr>
<td><?php include_once ('menu.php');?></td>
</tr>
<tr>
<td><?php include_once ('content.php');?></td>
</tr>
<tr>
<td><?php include_once ('footer.php');?></td>
</tr>
</table>
|
или index.php..
<?php include_once('functions.php');?>
<table width="200" border="1">
<tr>
<td><?php _menu()?></td>
</tr>
<tr>
<td><?php _content()?></td>
</tr>
<tr>
<td><?php _footer()?></td>
</tr>
</table>
|
а как в этом файле сделать подгрузку разных шаблонов дайте самый простейший пример ... | |
|
|
|
|
|
|
|
для: serjinio
(03.03.2009 в 23:34)
| |
<?
$page = isset($_GET['page'])?$_GET['page']:NULL;
switch($page)
{
case 1:
$menu = 'menu1.php';
$content = 'content1.php';
$footer = 'footer1.php'
break;
case 2:
$menu = 'menu2.php';
$content = 'content2.php';
$footer = 'footer2.php'
break;
default:
$menu = 'menu1.php';
$content = 'content1.php';
$footer = 'footer1.php'
}
?>
<a href="?page=1">Страница 1</a>
<a href="?page=2">Страница 2</a>
<table width="200" border="1">
<tr>
<td><?php include_once ($menu);?></td>
</tr>
<tr>
<td><?php include_once ($content);?></td>
</tr>
<tr>
<td><?php include_once ($footer);?></td>
</tr>
</table>
|
| |
|
|
|
|
|
|
|
для: Николай2357
(04.03.2009 в 00:19)
| | ага ,спасибо суть понял..кстати интересно как правильно
$page = isset($_GET['page']) ? $_GET['page'] : NULL;
или
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
| |
|
|
|
|
|
|
|
для: serjinio
(04.03.2009 в 00:35)
| | Правильно null потому что хоть между апострофами (или кавычками) ничего нет, интерпретатор будет пытаться там что нибудь найти. Зачем мучать бедный интерпретатор? ))) | |
|
|
|