Tengo unas dudas que agradeceria que me ayudaseis a resolverlas.
Resulta que, vereis yo empece en esto del php ara un año o asi pero aun soy bastante principiante tengo 15 años, y estoy intentando de crear una pagina web modulada.
Mi problema es que por ahora he conseguido hacer que mediante includes y switches, viendo varios tutoriales y entendiendo como va el codigo, de poder mostrar las distintas paginas o "modulos" que ponga en una variable via get, por ejemplo www.web.com/index.php?sec=descargas, pero no consigo de que a ese modulo descargas, que puede ser por ejemplo "descargas.php" a ese modulo le lleguen variables que le hacen falta para funcionar correctamente, como por ejemplo el nombre de alguna descarga para que muestre esa sola, lo que me funcionaba a mi antes de la siguiente manera "descargas.php?nombre=Winamp".
Os dejo aqui los codigos de como tengo montado esto.
Esto es index.php
Código PHP:
<?php
require_once("fich_conf.php");//fichero de configuracion
require_once("motor.php");//Sistema que se encarga de crear el header, footer y menus.
require_once("modulos.php");//Codigo encargado de los modulos, es quen tiene la funcion modulos()
global $sec;//variable utilizada para cambiar de modulo
//Se comprueba si "sec" esta vacio, si no lo esta, $sec = $_GET['sec']
if(!empty($_GET['sec']))
{
$sec=$_GET['sec'];
}
?>
<title><?php cw_get_htitle($link)?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<center>
<table width="760" border="0" cellpadding="0" cellspacing="0" class="fondo">
<!--DWLayoutTable-->
<tr>
<td height="107" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="81" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="81" valign="top" class="header"><div align="center">{HEADER}</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="26" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="26" valign="top"><div align="center">{MENU_SUP}</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td width="141" valign="top"><table width="100%"border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td valign="top" width="141">
<?php
cw_get_lmenu($link);
?>
</td>
</tr>
</table></td>
<td width="476" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="476" valign="top">
<?php modulos($sec)?>
</td>
</tr>
<tr>
<td></td>
</tr>
</table></td>
<td width="143" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="141" height="33" valign="top">{MENU_DER}</td>
</tr>
<tr>
<td height="388"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="72" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="72" class="footer"><?php cw_get_fmsg($link)?></td>
</tr>
</table></td>
</tr>
</table>
</center>
</body>
</html>
Código PHP:
<?php
function modulos($sec)
{
global $sec;
switch($sec)
{
default:
include("principal.php");
break;
case 'descargas':
include("descargas.php");
break;
}
}
?>
Un Saludo!