Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][HTML][CSS]Funkcja include.
ktesibios
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 14.03.2009

Ostrzeżenie: (0%)
-----


Witam wszystkich!
Jestem nowym użytkownikiem forum i z php nie miałem wiele do czynienia, mam skrypt z zagranicznej strony i skrypt ma za zadanie generowanie praktycznie wszystkich podstron, cala stronę miałem oparta na ramkach teraz chce się wyzbyć ramek i mój problem zaczyna się przy includowaniu treści z php.

Cala stronę mam podzielona na kilka sekcji w divach menu jest oparte na css. I chodzi mi o to by przy kliknięciu z menu strona wyświetlała się w divie "main". Korzystam z następującego skryptu:
CODE

if (isset($_GET['page']))
{
$page = $_GET['page'];
if(!empty($page))
if (is_file("$page"))
include ("$page");
else
echo "Podana strona nie istnieje.";
}
else
include "home.php";
?>


I wszystko jest dobrze dopóki w linkach są konkretne pliki przykladowo:
CODE
<li><a href="index.php?prace.php" >Moje prace</a></li>

problem zaczyna sie gdy link ze skryptu przyjmuje postac taka:
CODE
<li><a href="index.php?page=prace.php?mod=kat&kid=3" >Moje fotografie</a></li>

i wtedy include jaki stosuje nie chodzi? Czy ktoś mógł by mi pomóc jak sobie z tym poradzić ew. coś doradzić? z góry bardzo dziękuje za pomoc.

Dołączam index.php w którym jest fragment tego mojego menu i ten skrypt:
CODE

<?
session_start();
if(!$_SESSION['lang']) $_SESSION['lang']='pl';
if($_GET['lang']) $_SESSION['lang']=$_GET['lang'];
header("Content-Type: text/html; charset=ISO-8859-2");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />

<title> tytul</title>
<link href="style2.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="container">
<div id="header">
<h1>Header</h1>
<ul id="menu">
<li><a href="index.php?page=his.php">O mnie » &nbsp; &nbsp;
<!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
</a>
<ul>
<li><a href="index.php?page=home.php" >Tytul1</a></li>
<li><a href="index.php?page=rozne.php" >Rozne » </a></li>
<li><a href="index.php?page=content.php?content=Prace" >Prace »
<!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->

</a><ul>
<li><a href="index.php?page=prace.php?mod=kat&kid=3">Fotografie</a></li>
<li><a href="index.php?page=prace.php?mod=kat&kid=4">Rysunki</a></li
></ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>

<li><a href="index.php?page=produkty.php?dzial=2" >Sztuka a sztuka</a></li>
<li><a href="index.php?page=produkty.php?dzial=4" >W obiektywie</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>

<li><a href="index?page=produkty.php?dzial=5">Multimedia »
<!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
</a>
<ul>
<li> </a><a href="index.php?galeria.php">Galeria</a></li>
<li> </a><a href="index.php?page=nagrania.php">Nagrania </a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>

</ul>
<!-- end #header --></div>
<div id="main">

<?php
if (isset($_GET['page']))
{
$page = $_GET['page'];
if(!empty($page))
if (is_file("$page"))
include ("$page");
else
echo "Podana strona nie istnieje.";
}
else
include "home.php";
?>

<!-- end #main --></div>
<div id="footer">

<!-- end #footer --></div>
<div id="copyright">

<p>Copyright &copy; 2003-2009 <a href="mailto:ktesibios@gmail.com"Ktesibios</a>. Wszelkie prawa Zastrzeżone. </p>

<!-- end #copyright --></div>
<!-- end #container --></div>
</body>
</html>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 18:09