Ver Mensaje Individual
  #7 (permalink)  
Antiguo 07/02/2011, 06:48
Avatar de Chenon
Chenon
 
Fecha de Ingreso: abril-2005
Ubicación: Palma de Mallorca
Mensajes: 99
Antigüedad: 19 años, 1 mes
Puntos: 11
Respuesta: cambiar dinamicamente una hoja de estilos css mediante php

Código HTML:
Ver original
  1. <?
  2. $el_css = "azul.css";
  3. if($_REQUEST['seleccionCss']!="") $el_css = $_REQUEST['el_css']);
  4. $_SESSION['css']=$el_css;
  5. ?>
  6.  
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  8. <html xmlns="http://www.w3.org/1999/xhtml">
  9. <head>
  10.  
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  12. <title>Documento sin título</title>
  13. <link href="<?=$_SESSION['css']?>" rel="stylesheet" type="text/css" /> <!--Llamada a la hoja  
  14.  
  15. de estilos css-->
  16. </head>
  17.  
  18. <body id="header">
  19. <div id="container">
  20. <!--_____________________________________________________________________________TABLA MAQUETADORA-->
  21.   <table align="center" width="70%" border="1" >
  22.     <tr>
  23.       <td id="cabecera" colspan="3" align="center">FORO - CAMBIAR COLORES</td>
  24.  
  25.     </tr>
  26.     <tr>
  27.       <td id="menu" width="33%" align="center"><a href="nueva_discusion.php">NUEVA DISCUSIÓN</a></td>
  28.       <td id="menu" width="33%" align="center"><a href="id_editor.php">EDITOR</a></td>
  29.        <td id="menu" width="33%" align="center"><a href="cambiar_colores.php">CAMBIAR COLORES</a></td>
  30.     </tr>
  31.     <tr>
  32.       <td colspan="3" id="fondo_foro">
  33.          
  34. <!--_____________________________________________________________________________TABLA DE INTERVENCIONES-->
  35.         <div id="intervenciones" align="center">
  36.              
  37.             <p></p>
  38.  
  39.               <FORM METHOD="POST" ACTION="">
  40.               <select name="seleccionCss">
  41.               COLORES: <option value="blancoNegro">Blanco y negro</option>
  42.                          <option value="rojo">Rojos</option>
  43.                          <option value="verde">Verdes</option>
  44.                        <option value="azul">Azul</option>
  45.               </select>
  46.               <p></p>
  47.               <p></p>
  48.               <input type="submit" name="submit" value="OK"></p>
  49.               </FORM>
  50.                
  51.          
  52.               </td></tr>
  53.               </table>
  54.    
  55. <!--_____________________________________________________________________________FIN DE TABLA DE INTERVENCIONES-->
  56.  
  57.         </div>
  58.         </td>
  59.     </tr>
  60.   </table>
  61. <!--_____________________________________________________________________________FIN DE TABLA MAQUETADORA-->
  62. </div>
  63. </body>
  64. </html>


Prueba eso, a ver si te va.
Es una solución muy básica, pero a partir de ahi te haces una idea de como funciona y puedes ir mejorando el script.

Personalmente, yo lo haría con javascript (jQuery).
__________________
www.serra-project.es