|  | Posted by petersprc on 06/20/07 11:06 
Here's one way:
 [home.php]
 <?
 $title = 'My Site - Home';
 require('header.php');
 ?>
 
 <p>Home</p>
 
 <? require('footer.php') ?>
 
 [header.php]
 <html>
 <head>
 <title><?= $title ?></title>
 </head>
 <body>
 
 [footer.php]
 </body>
 </html>
 
 You can browse to home.php and see your template. If you need an
 index.php controller, you could do:
 
 [index.php]
 <?
 
 $pages = array('home' => '', 'services' => '', 'about' => '');
 
 if (isset($pages[$_GET['page']])) {
 $page = $_GET['page'];
 } else {
 $page = 'home';
 }
 
 $title = 'My Site';
 
 require("$page.php");
 
 ?>
 
 On Jun 18, 12:14 pm, "Proximus" <veleprodajaOBRISI...@proximus-os.hr>
 wrote:
 > hello, at first, sorry on my bad english.
 >
 > i have a problem.
 >
 > on
 > index.php:
 >
 > <?
 > $include=array(
 >  "link"=>"link.html",
 > );
 > $stranica="prva.html";
 > if(isset($_GET)){
 >  $str=array_keys($_GET);
 >  if(array_key_exists($str[0],$include)){
 >   $stranica=$include[$str[0]];
 >  }}
 >
 > ?>
 > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 > "http://www.w3.org/TR/html4/strict.dtd">
 > <html>
 > <head>
 > <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 > <title>Untitled Document</title>
 > </head>
 > <body>
 >     <li><a href="index.php?pocetna">Pocetna</a></li>
 >      <li><a href="index.php?link">linkovi</a></li><br>
 >         <?php include($stranica); ?>
 > </body>
 > </html>
 >
 > link.html:
 >
 > <?php
 > $moj_naslov='linkovi';
 > ?>
 > <h2>Linkovi</h2>
 >
 > prva.html:
 >
 > <?php
 > $moj_naslov='prva stranica';
 > ?>
 > <h2>Prva Stranica</h2>
 >
 > how in index.php to change
 >
 > <title>Untitled Document</title>
 >
 > into <title>linkovi</title> or <title>prva stranica</title> depending what
 > is loaded
 >
 > "moj_naslov" means "my title"
 >
 > thanks from Croatia.
  Navigation: [Reply to this message] |