ayuda con includes en variable
miren lo que nesecito
este archivo se llama maestro.php por ejemplo y tiene un include llamando a centro.php
aqui esta
<html>
<head>
<title>Maestro</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include("http://www.mipage.com/centro.php");
?>
</body>
</html>
Lo que me gustaria hacer es que el include me llame a el archivo que yo le indique cuando lo llame
especificandole alguna variable por ejemplo cuando lo llame
algo como
http://www.mipage.com/maestro.php?variable=centro2.php (variable para que llame a ) centro2.php o centro3.php , ext
espero que entiendan esta pregunta ! gracias
este archivo se llama maestro.php por ejemplo y tiene un include llamando a centro.php
aqui esta
<html>
<head>
<title>Maestro</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include("http://www.mipage.com/centro.php");
?>
</body>
</html>
Lo que me gustaria hacer es que el include me llame a el archivo que yo le indique cuando lo llame
especificandole alguna variable por ejemplo cuando lo llame
algo como
http://www.mipage.com/maestro.php?variable=centro2.php (variable para que llame a ) centro2.php o centro3.php , ext
espero que entiendan esta pregunta ! gracias
deberias usar switch y case, como lo harias en el caso de las secciones.. algo asi..
en el archivo maestro.php deberias poner esto:
<html>
<head>
<title>Maestro</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
switch($variable) {
case "centro2":
include ("http://www.mipage.com/centro2.php");
break;
case "centro3":
include ("http://www.mipage.com/centro3.php");
break;
default:
include ("http://www.mipage.com/centro.php");
}
?>
</body>
</html>
en el archivo maestro.php deberias poner esto:
<html>
<head>
<title>Maestro</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
switch($variable) {
case "centro2":
include ("http://www.mipage.com/centro2.php");
break;
case "centro3":
include ("http://www.mipage.com/centro3.php");
break;
default:
include ("http://www.mipage.com/centro.php");
}
?>
</body>
</html>
