Pagina 1 din 1

content.php switch

Scris: Mie Feb 02, 2011
de Komfort
index.php

Cod: Selectaţi tot

<?php
include 'style.php';
echo 
'<div style="position:absolute;top:5px;left:37%"><img src="head1.jpg"></div>
<div style="position:absolute;top:324px;left:37%"><img src="head2.jpg" style="opacity:1;filter:alpha(opacity=100)" onmouseover="this.style.opacity=0.6;this.filters.alpha.opacity=50 " onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100" ></div>
<div style="position:absolute;top:460px;left:37%"><img src="head3.jpg"></div>';

echo ' <!--Meniu-->';

echo '<div style="position:absolute;top:330px;left:39%"><font  size=4><b><a href="index.php?pagina=a">Home</a></b></font></div>
<div style="position:absolute;top:353px;left:39%"><font  size=4><b><a href="regulament.php?pagina=b">Regulament</a></b></font></div>
<div style="position:absolute;top:376px;left:39%"><font  size=4><b><a href="login.php?pagina=c">Login</a></b></font></div>
<div style="position:absolute;top:399px;left:39%"><font  size=4><b><a href="register.php?pagina=d">Register</a></b></font></div>
';
include 'content.php';
?>
content.php

Cod: Selectaţi tot

<?php
switch($pagina){
case a: include 'index.php';
case b: include 'regulament.php';
case c: include 'login.php';
case d: include 'register.php';
}
?>
de ce nu merge?
imi apare de ex cand dau click pe regulamet.php
imi apare doar ce e in regulametn .php si trebe cu tot cu ce e in index

unde am gresit?

content.php switch

Scris: Mie Feb 02, 2011
de MarPlo
In "regulametn .php" e inclus "index.php", cu include()?
Sau ar trebui link-ul de la Regulament cu adresa la fisierul "index.php"

Cod: Selectaţi tot

<a href="index.php?pagina=b">Regulament</a>

content.php switch

Scris: Joi Feb 03, 2011
de Komfort
<a href="regulament.php?pagina=b">Regulament</a>

nu ar fi logic asa?:|

content.php switch

Scris: Joi Feb 03, 2011
de MarPlo
Adresa "regulament.php?pagina=b" deschide fisierul "regulament.php", dar fiindca switch-ul cu include e in "content.php", care e inclu in "index.php", pentru a face ce vrei trebuie accesat fisierul index.php.

content.php switch

Scris: Joi Feb 03, 2011
de Komfort
oare e bun cum am facut la content.php?

content.php switch

Scris: Joi Feb 03, 2011
de nikuu2
Salut! Incearca asa:
Index.php

Cod: Selectaţi tot

<?php
include 'style.php';
echo
'<div style="position:absolute;top:5px;left:37%"><img src="head1.jpg"></div>
<div style="position:absolute;top:324px;left:37%"><img src="head2.jpg" style="opacity:1;filter:alpha(opacity=100)" onmouseover="this.style.opacity=0.6;this.filters.alpha.opacity=50 " onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100" ></div>
<div style="position:absolute;top:460px;left:37%"><img src="head3.jpg"></div>';

echo ' <!--Meniu-->';

echo '<div style="position:absolute;top:330px;left:39%"><font  size=4><b><a href="'.$_SERVER['PHP_SELF'].'?pagina=a">Home</a></b></font></div>
<div style="position:absolute;top:353px;left:39%"><font  size=4><b><a href="'.$_SERVER['PHP_SELF'].'?pagina=b">Regulament</a></b></font></div>
<div style="position:absolute;top:376px;left:39%"><font  size=4><b><a href="'.$_SERVER['PHP_SELF'].'?pagina=c">Login</a></b></font></div>
<div style="position:absolute;top:399px;left:39%"><font  size=4><b><a href="'.$_SERVER['PHP_SELF'].'?pagina=d">Register</a></b></font></div>
';
if (isset($_GET['pagina'])&&$_GET['pagina']!=""){ 
$pagina=$_GET['pagina'];
include 'content.php';
}
?>
content.php

Cod: Selectaţi tot

<?php
switch($pagina){
case "a": include 'index.php'; break;
case "b": include 'regulament.php'; break;
case "c": include 'login.php'; break;
case "d": include 'register.php'; break;
}
?>