cambio automático de navegación página

  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 8th, 2010, 11:17 am

¿Es posible el uso de código PHP similar al siguiente para que cada página de recuperar algunos datos de una hoja de estilo en cascada que se utiliza para cambiar el color de fondo de la barra de navegación web?

Código: [ Select ]
$page_handle = ltrim($_SERVER["PHP_SELF"],'/');
$page_handle = rtrim($page_handle,'.php');

$title_array = array(
  'index' => 'Index',
  'contact' => 'contact',
  'guestbook' => 'guestbook',
  'anotherpage1' => 'another1',
  'anotherpage2' => 'another2',
);

foreach ( $title_array as $a => $b ) {
if ( $page_handle == $a) {
  $page_title = "Welcome!"; }
}
}
if ( !isset($page_title) ) { $page_title = "Welcome!"; }
  1. $page_handle = ltrim($_SERVER["PHP_SELF"],'/');
  2. $page_handle = rtrim($page_handle,'.php');
  3. $title_array = array(
  4.   'index' => 'Index',
  5.   'contact' => 'contact',
  6.   'guestbook' => 'guestbook',
  7.   'anotherpage1' => 'another1',
  8.   'anotherpage2' => 'another2',
  9. );
  10. foreach ( $title_array as $a => $b ) {
  11. if ( $page_handle == $a) {
  12.   $page_title = "Welcome!"; }
  13. }
  14. }
  15. if ( !isset($page_title) ) { $page_title = "Welcome!"; }


Si es posible, es posible que alguien me informe sobre cómo iba a ir para lograrlo?

Gracias
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Marzo 8th, 2010, 11:17 am

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 8th, 2010, 2:56 pm

¿Estás tratando de hacerlo de modo que cuando su visita una página de la navegación de fondo cambia de color?

Ejemplo:

http://wazzutke.com
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 8th, 2010, 3:02 pm

No estoy viendo realmente ningún cambio en eso, pero creo que me entiendes.

El sitio i actualmente estoy trabajando en -- http://www.campbell-james.co.uk/new/template.php - Se construye donde tengo el código PHP, incluyendo 2 páginas en la página de cada uno. La primera página se acumula la primera mitad del código de sitio y la segunda página se acumula la segunda mitad. Pensé que esto hacía mucho sentido para crear un sitio que a la larga tendrá una gran cantidad de páginas.

Debido a la forma en que el sitio ha sido diseñado, la intención era que el área de navegación azul para cambiar el color en cada página se carga arriba. Eso es lo que yo esperaba hacer y pensé que sería posible hacer uso de código similar a la que he publicado anteriormente.
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 8th, 2010, 3:59 pm

También me preguntaba si había alguna forma de tener una imagen de apertura de una carpeta para cada página utilizando el mismo tipo de código de arriba?

Pensé que sería relativamente fácil de entender, pero mis conocimientos de PHP no es tan amplia como yo preferiría.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 8th, 2010, 4:27 pm

Bueno, por lo que desea la zona azul para cambiar de color dependiendo de qué página es la opinión de ser. ¿Correcto?

El código actual está en el camino correcto. Lo que yo sugiero es crear una matriz de sus páginas.

PHP Código: [ Select ]
$page_name = basename($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
 
$myPages = array(
   'pageName'=>'styleClass',
   'pageName'=>'styleClass',
   'pageName'=>'styleClass',
   'pageName'=>'styleClass'
        );
 
$use_style = $myPages[$page_name];
  1. $page_name = basename($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
  2.  
  3. $myPages = array(
  4.    'pageName'=>'styleClass',
  5.    'pageName'=>'styleClass',
  6.    'pageName'=>'styleClass',
  7.    'pageName'=>'styleClass'
  8.         );
  9.  
  10. $use_style = $myPages[$page_name];


Entonces sería crear clases de estilo o las identificaciones, si para cada página. Usted podría incluso sólo usar colores.

Código: [ Select ]
'pageName'=>'blue',


CSS Código: [ Select ]
.blue {
background-color: #0000FF;
}
  1. .blue {
  2. background-color: #0000FF;
  3. }
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 8th, 2010, 4:33 pm

Gracias falsos.

Lo que estoy seguro de aquí sin embargo es, ¿cómo puedo hacer que sea específico a la barra sólo la navegación?
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 8th, 2010, 4:50 pm

Para su menú, me gustaría añadir una clase a la misma.

PHP Código: [ Select ]
<div id="menu" class="<?=$use_style?>">


Use ese estilo para aplicar el color.

Para limitar el estilo de trabajar únicamente con el menú:
CSS Código: [ Select ]
div#menu.color1
{
   background-color:#f00;
}
  1. div#menu.color1
  2. {
  3.    background-color:#f00;
  4. }
#define NULL (::rand() % 2)
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 8th, 2010, 5:05 pm

Aquí hay un ejemplo rápido que hice.

Código: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>James Campbell Architects - Welcome!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
<meta name="description" content="www.campbell-james.co.uk - James Campbell Architects" >
<meta name="keywords" content="James Campbell Architects, James, Campbell, Architects, Aberdeen, Scotland, Inverurie, Environmental" >
<meta name="robots" content="index,follow" >
<link rel="shortcut icon" href="http://www.campbell-james.co.uk/new/images/favicon.ico" >
<link rel="stylesheet" href="http://www.campbell-james.co.uk/new/style.css" >

<style type="text/css">

div#menu.style1
{
    background-color:#f00;
}
div#menu.style2
{
    background-color:#0f0;
}
div#menu.style3
{
    background-color:#00f;
}

</style>

</head>

<?php

$page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
$page_name = $page_name['filename'];


$myPages = array(
  'pageName1'=>'style1',
  'pageName2'=>'style2',
  'pageName3'=>'style3'
    );

$use_style = $myPages[$page_name];

?>

<body>

<div id="menu" class="<?=$use_style?>">
    <ul id="qm0" class="qmmc">
        <li><a class="qmparent" href="index.php">Home</a></li>
        <li><a class="qmparent" href="index.php">Home</a></li>
        <li><a class="qmparent" href="index.php">Home</a></li>
        <li><a class="qmparent" href="index.php">Home</a></li>
        <li><a class="qmparent" href="index.php">Home</a></li>
        <li><a class="qmparent" href="index.php">Home</a></li>
        <li><a class="qmparent" href="index.php">Home</a></li>
    </ul>

</div>
</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2.      "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>James Campbell Architects - Welcome!</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
  7. <meta name="description" content="www.campbell-james.co.uk - James Campbell Architects" >
  8. <meta name="keywords" content="James Campbell Architects, James, Campbell, Architects, Aberdeen, Scotland, Inverurie, Environmental" >
  9. <meta name="robots" content="index,follow" >
  10. <link rel="shortcut icon" href="http://www.campbell-james.co.uk/new/images/favicon.ico" >
  11. <link rel="stylesheet" href="http://www.campbell-james.co.uk/new/style.css" >
  12. <style type="text/css">
  13. div#menu.style1
  14. {
  15.     background-color:#f00;
  16. }
  17. div#menu.style2
  18. {
  19.     background-color:#0f0;
  20. }
  21. div#menu.style3
  22. {
  23.     background-color:#00f;
  24. }
  25. </style>
  26. </head>
  27. <?php
  28. $page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
  29. $page_name = $page_name['filename'];
  30. $myPages = array(
  31.   'pageName1'=>'style1',
  32.   'pageName2'=>'style2',
  33.   'pageName3'=>'style3'
  34.     );
  35. $use_style = $myPages[$page_name];
  36. ?>
  37. <body>
  38. <div id="menu" class="<?=$use_style?>">
  39.     <ul id="qm0" class="qmmc">
  40.         <li><a class="qmparent" href="index.php">Home</a></li>
  41.         <li><a class="qmparent" href="index.php">Home</a></li>
  42.         <li><a class="qmparent" href="index.php">Home</a></li>
  43.         <li><a class="qmparent" href="index.php">Home</a></li>
  44.         <li><a class="qmparent" href="index.php">Home</a></li>
  45.         <li><a class="qmparent" href="index.php">Home</a></li>
  46.         <li><a class="qmparent" href="index.php">Home</a></li>
  47.     </ul>
  48. </div>
  49. </body>
  50. </html>


Una cosa es que tienes que quitar la background-color atributo de su #menú la clase no sobre el derecho de ella.

Observe también he cambiado la manera puedo obtener el nombre de archivo.
PHP Código: [ Select ]
$page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
$page_name = $page_name['filename'];
  1. $page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
  2. $page_name = $page_name['filename'];
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 8th, 2010, 5:13 pm

Gracias falsos.

De hecho, estoy teniendo problemas con la CSS en la barra de navegación que está causando los problemas.

Su ayuda ha sido muy apreciada. Con el tiempo un poco más enfermos tienen el resto de ella Sussed espero.

Muchas gracias.
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 8th, 2010, 5:41 pm

Está bien, aquí es lo que Ive consiguió...

Código: [ Select ]
$page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
$page_name = $page_name['filename'];
$myPages = array(
 'new/index'=>'blue',
 'pageName2'=>'style2',
 'pageName3'=>'style3'
  );
$use_style = $myPages[$page_name];
  1. $page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
  2. $page_name = $page_name['filename'];
  3. $myPages = array(
  4.  'new/index'=>'blue',
  5.  'pageName2'=>'style2',
  6.  'pageName3'=>'style3'
  7.   );
  8. $use_style = $myPages[$page_name];


En mi página index.php. Debajo de eso en la navegación que han...

Código: [ Select ]
<div id="menu" class="<?=$use_style?>">
  <ul id="qm0" class="qmmc">
   <li><a class="qmparent" href="index.php">Home</a> <br />
   <li><a class="qmparent" href="javascript:void(0)">Architectural Services</a>
    <ul>
     <li><a href="/community.php">Community</a></li>
     <li><a href="residential.php">Residential</a></li>
     <li><a href="social.php">Social Housing</a></li>
     <li><a href="industrial.php">Industrial</a></li>
     <li><a href="leisure.php">Leisure</a></li>
     <li><a href="commercial.php">Commercial</a></li>
     <li><a href="education.php">Education</a></li>
     <li><a href="health.php">Health</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Environmental Services</a>
    <ul>
     <li><a href="energydesign.php">Energy Design</a></li>
     <li><a href="nher.php">NHER, SAP</a></li>
     <li><a href="epc.php">EPCs, OCDEA</a></li>
     <li><a href="carbontrust.php">Carbon Trust</a></li>
     <li><a href="designadvice.php">Design Advice</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Other Services</a>
    <ul>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Resources & Links</a>
    <ul>
     <li><a href="http://www.architecture.com" target="_new">RIBA</a></li>
     <li><a href="http://www.rias.org.uk" target="_new">RIAS</a></li>
     <li><a href="http://www.carbontrust.co.uk" target="_new">Carbon Trust</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Contact Us</a>
   <li class="qmclear"></li>
  </ul>
  1. <div id="menu" class="<?=$use_style?>">
  2.   <ul id="qm0" class="qmmc">
  3.    <li><a class="qmparent" href="index.php">Home</a> <br />
  4.    <li><a class="qmparent" href="javascript:void(0)">Architectural Services</a>
  5.     <ul>
  6.      <li><a href="/community.php">Community</a></li>
  7.      <li><a href="residential.php">Residential</a></li>
  8.      <li><a href="social.php">Social Housing</a></li>
  9.      <li><a href="industrial.php">Industrial</a></li>
  10.      <li><a href="leisure.php">Leisure</a></li>
  11.      <li><a href="commercial.php">Commercial</a></li>
  12.      <li><a href="education.php">Education</a></li>
  13.      <li><a href="health.php">Health</a></li>
  14.     </ul>
  15.    </li>
  16.    <br />
  17.    <li><a class="qmparent" href="javascript:void(0)">Environmental Services</a>
  18.     <ul>
  19.      <li><a href="energydesign.php">Energy Design</a></li>
  20.      <li><a href="nher.php">NHER, SAP</a></li>
  21.      <li><a href="epc.php">EPCs, OCDEA</a></li>
  22.      <li><a href="carbontrust.php">Carbon Trust</a></li>
  23.      <li><a href="designadvice.php">Design Advice</a></li>
  24.     </ul>
  25.    </li>
  26.    <br />
  27.    <li><a class="qmparent" href="javascript:void(0)">Other Services</a>
  28.     <ul>
  29.      <li><a href="javascript:void(0)">Sub menu</a></li>
  30.      <li><a href="javascript:void(0)">Sub menu</a></li>
  31.      <li><a href="javascript:void(0)">Sub menu</a></li>
  32.      <li><a href="javascript:void(0)">Sub menu</a></li>
  33.      <li><a href="javascript:void(0)">Sub menu</a></li>
  34.     </ul>
  35.    </li>
  36.    <br />
  37.    <li><a class="qmparent" href="javascript:void(0)">Resources & Links</a>
  38.     <ul>
  39.      <li><a href="http://www.architecture.com" target="_new">RIBA</a></li>
  40.      <li><a href="http://www.rias.org.uk" target="_new">RIAS</a></li>
  41.      <li><a href="http://www.carbontrust.co.uk" target="_new">Carbon Trust</a></li>
  42.     </ul>
  43.    </li>
  44.    <br />
  45.    <li><a class="qmparent" href="javascript:void(0)">Contact Us</a>
  46.    <li class="qmclear"></li>
  47.   </ul>


En el i CSS han...

Código: [ Select ]
div#menu.blue
{
  background-color:#000000;
}
div#menu.style2
{
  background-color:#0f0;
}
div#menu.style3
{
  background-color:#00f;
}
  1. div#menu.blue
  2. {
  3.   background-color:#000000;
  4. }
  5. div#menu.style2
  6. {
  7.   background-color:#0f0;
  8. }
  9. div#menu.style3
  10. {
  11.   background-color:#00f;
  12. }


Me quité el color de fondo en la parte del menú.

Parece como si la página PHP no reconoce el código CSS de la hoja CSS que tiene. El código actual de CSS se hace en una página de CSS independiente.

No del todo seguro de lo que realmente anda mal aquí como lo he hecho everthing que usted menciona.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 8th, 2010, 5:52 pm

En primer lugar, comprobar si $ page_name es lo que tu espera que sea. Añade un eco o de impresión para ver lo que sea establecido. También puede simplemente comprobar la fuente y ver qué nombre del estilo se está imprimiendo para la clase. Si su impresión de la clase correcta, entonces su problema con el CSS.

Solucionar problemas de la CSS que eliminaría el div #menú y hacer que la clase mundial.
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 9th, 2010, 5:58 pm

:lol:

Estoy bien y verdaderamente perdido aquí. Manera de salir de mi profundidad.

Estado estudiando este problema por un corto tiempo de hoy y que no tengan suerte en todo.

Su ayuda ha sido grande falsos, por lo que agradezco mucho. Tengo la sensación de que es algo que tiene que ver con la forma en que el sitio se ha construido, aunque no puedo averiguar por qué. Se me está acabando de pelo a sacar! :evil:
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 9th, 2010, 6:48 pm

Su servidor no podría apoyar el código PHP corto. Miré a su fuente y algunos de los PHP no está siendo reconocido.

Código: [ Select ]
<div id="image">
 <div align="right"></div>
</div>

<div id="menu" class="<?=$use_style?>">
  <ul id="qm0" class="qmmc">
  1. <div id="image">
  2.  <div align="right"></div>
  3. </div>
  4. <div id="menu" class="<?=$use_style?>">
  5.   <ul id="qm0" class="qmmc">


Puede que tenga que hacer algo como esto:

Código: [ Select ]
<div id="image">
 <div align="right"></div>
</div>

<div id="menu" class="<?php echo $use_style; ?>">
  <ul id="qm0" class="qmmc">
  1. <div id="image">
  2.  <div align="right"></div>
  3. </div>
  4. <div id="menu" class="<?php echo $use_style; ?>">
  5.   <ul id="qm0" class="qmmc">
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de Usuario
  • Registrado: Nov 16, 2004
  • Mensajes: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Nota Marzo 9th, 2010, 7:05 pm

Gracias. Todavía no hay suerte en todo.

Yo estaba un poco reacio a publicar el código completo, pero si hay alguna forma de que alguien pueda averiguar qué puede estar causando el problema, entonces yo estaría muy agradecido.

Como dije el sitio está construido usando 2 documentos principales para construir el diseño general del sitio. Esta es la primera parte de la página que he cambiado para fines Ozzu sólo a "include1"

Código: [ Select ]
<?php
// Prevent users from looking at this include file directly
if ( strpos($_SERVER["PHP_SELF"],"include1.php") !== false ) {
  header ('Location:index.php');
  exit();
}
else {
// Automate page titles
$page_handle = ltrim($_SERVER["PHP_SELF"],'/');
$page_handle = rtrim($page_handle,'.php');

$title_array = array(
  'new/index' => 'blablabla',
  'contact' => 'contact',
  'environmental' => 'environmental',
    'anotherpage1' => 'another1',
    'anotherpage2' => 'another2',
);

foreach ( $title_array as $a => $b ) {
if ( $page_handle == $a) {
  $page_title = $b;
}
}
if ( !isset($page_title) ) { $page_title = "Welcome!"; }

// The following code determines what colour the navigation bar backdrop is depending on each page.

$page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
$page_name = $page_name['filename'];
$myPages = array(
 'new/index'=>'color1',
 'pageName2'=>'style2',
 'pageName3'=>'style3'
  );
$use_style = $myPages[$page_name];

// Init the date
$gmttime = time() + (5 * 60 * 60);

echo ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>James Campbell Architects - '. $page_title .'</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
<meta name="description" content="www.campbell-james.co.uk - James Campbell Architects" >
<meta name="keywords" content="James Campbell Architects, James, Campbell, Architects, Aberdeen, Scotland, Inverurie, Environmental" >
<meta name="robots" content="index,follow" >
<link rel="shortcut icon" href="http://www.campbell-james.co.uk/new/images/favicon.ico" >
<link rel="stylesheet" href="style.css" >

<style type="text/css">
.color1
{
  background-color:#f00;
}
.color2
{
  background-color:#0f0;
}
.color3
{
  background-color:#00f;
}
</style>

</head>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-412299-3";
urchinTracker();
</script>

<script type="text/javascript">
<!--
function delayer(){
  window.location = "../index.php"
}
//-->
</script>

<body>
<div id="page_container">

<div id="banner">
 <p>&nbsp;</p>
 <p> <img src="title3.png" width="1060" height="100" align="bottom" /></p>
</div>

<div id="image">
 <div align="right"></div>
</div>

<div id="menu" class="<?php echo $use_style; ?>">
 <ul id="qm0" class="qmmc">
   <li><a class="qmparent" href="index.php">Home</a> <br />
   <li><a class="qmparent" href="javascript:void(0)">Architectural Services</a>
    <ul>
     <li><a href="/community.php">Community</a></li>
     <li><a href="residential.php">Residential</a></li>
     <li><a href="social.php">Social Housing</a></li>
     <li><a href="industrial.php">Industrial</a></li>
     <li><a href="leisure.php">Leisure</a></li>
     <li><a href="commercial.php">Commercial</a></li>
     <li><a href="education.php">Education</a></li>
     <li><a href="health.php">Health</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Environmental Services</a>
    <ul>
     <li><a href="energydesign.php">Energy Design</a></li>
     <li><a href="nher.php">NHER, SAP</a></li>
     <li><a href="epc.php">EPCs, OCDEA</a></li>
     <li><a href="carbontrust.php">Carbon Trust</a></li>
     <li><a href="designadvice.php">Design Advice</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Other Services</a>
    <ul>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
     <li><a href="javascript:void(0)">Sub menu</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Resources & Links</a>
    <ul>
     <li><a href="http://www.architecture.com" target="_new">RIBA</a></li>
     <li><a href="http://www.rias.org.uk" target="_new">RIAS</a></li>
     <li><a href="http://www.carbontrust.co.uk" target="_new">Carbon Trust</a></li>
    </ul>
   </li>
   <br />
   <li><a class="qmparent" href="javascript:void(0)">Contact Us</a>
   <li class="qmclear"></li>
  </ul>

<p><script type="text/javascript">qm_create(0,true,0,500,false,false,false,false,false);</script>
</p>
</div>
<div id="quote">
 <div align="center">
  <p><img src="quotation.jpg" align="top" /></p>
  </div>
</div>
<div id="content">
');
}

?>
  1. <?php
  2. // Prevent users from looking at this include file directly
  3. if ( strpos($_SERVER["PHP_SELF"],"include1.php") !== false ) {
  4.   header ('Location:index.php');
  5.   exit();
  6. }
  7. else {
  8. // Automate page titles
  9. $page_handle = ltrim($_SERVER["PHP_SELF"],'/');
  10. $page_handle = rtrim($page_handle,'.php');
  11. $title_array = array(
  12.   'new/index' => 'blablabla',
  13.   'contact' => 'contact',
  14.   'environmental' => 'environmental',
  15.     'anotherpage1' => 'another1',
  16.     'anotherpage2' => 'another2',
  17. );
  18. foreach ( $title_array as $a => $b ) {
  19. if ( $page_handle == $a) {
  20.   $page_title = $b;
  21. }
  22. }
  23. if ( !isset($page_title) ) { $page_title = "Welcome!"; }
  24. // The following code determines what colour the navigation bar backdrop is depending on each page.
  25. $page_name = pathinfo($_SERVER['PHP_SELF']); // This will return the PHP file name of the current file
  26. $page_name = $page_name['filename'];
  27. $myPages = array(
  28.  'new/index'=>'color1',
  29.  'pageName2'=>'style2',
  30.  'pageName3'=>'style3'
  31.   );
  32. $use_style = $myPages[$page_name];
  33. // Init the date
  34. $gmttime = time() + (5 * 60 * 60);
  35. echo ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  36.      "http://www.w3.org/TR/html4/loose.dtd">
  37. <html>
  38. <head>
  39. <title>James Campbell Architects - '. $page_title .'</title>
  40. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
  41. <meta name="description" content="www.campbell-james.co.uk - James Campbell Architects" >
  42. <meta name="keywords" content="James Campbell Architects, James, Campbell, Architects, Aberdeen, Scotland, Inverurie, Environmental" >
  43. <meta name="robots" content="index,follow" >
  44. <link rel="shortcut icon" href="http://www.campbell-james.co.uk/new/images/favicon.ico" >
  45. <link rel="stylesheet" href="style.css" >
  46. <style type="text/css">
  47. .color1
  48. {
  49.   background-color:#f00;
  50. }
  51. .color2
  52. {
  53.   background-color:#0f0;
  54. }
  55. .color3
  56. {
  57.   background-color:#00f;
  58. }
  59. </style>
  60. </head>
  61. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  62. </script>
  63. <script type="text/javascript">
  64. _uacct = "UA-412299-3";
  65. urchinTracker();
  66. </script>
  67. <script type="text/javascript">
  68. <!--
  69. function delayer(){
  70.   window.location = "../index.php"
  71. }
  72. //-->
  73. </script>
  74. <body>
  75. <div id="page_container">
  76. <div id="banner">
  77.  <p>&nbsp;</p>
  78.  <p> <img src="title3.png" width="1060" height="100" align="bottom" /></p>
  79. </div>
  80. <div id="image">
  81.  <div align="right"></div>
  82. </div>
  83. <div id="menu" class="<?php echo $use_style; ?>">
  84.  <ul id="qm0" class="qmmc">
  85.    <li><a class="qmparent" href="index.php">Home</a> <br />
  86.    <li><a class="qmparent" href="javascript:void(0)">Architectural Services</a>
  87.     <ul>
  88.      <li><a href="/community.php">Community</a></li>
  89.      <li><a href="residential.php">Residential</a></li>
  90.      <li><a href="social.php">Social Housing</a></li>
  91.      <li><a href="industrial.php">Industrial</a></li>
  92.      <li><a href="leisure.php">Leisure</a></li>
  93.      <li><a href="commercial.php">Commercial</a></li>
  94.      <li><a href="education.php">Education</a></li>
  95.      <li><a href="health.php">Health</a></li>
  96.     </ul>
  97.    </li>
  98.    <br />
  99.    <li><a class="qmparent" href="javascript:void(0)">Environmental Services</a>
  100.     <ul>
  101.      <li><a href="energydesign.php">Energy Design</a></li>
  102.      <li><a href="nher.php">NHER, SAP</a></li>
  103.      <li><a href="epc.php">EPCs, OCDEA</a></li>
  104.      <li><a href="carbontrust.php">Carbon Trust</a></li>
  105.      <li><a href="designadvice.php">Design Advice</a></li>
  106.     </ul>
  107.    </li>
  108.    <br />
  109.    <li><a class="qmparent" href="javascript:void(0)">Other Services</a>
  110.     <ul>
  111.      <li><a href="javascript:void(0)">Sub menu</a></li>
  112.      <li><a href="javascript:void(0)">Sub menu</a></li>
  113.      <li><a href="javascript:void(0)">Sub menu</a></li>
  114.      <li><a href="javascript:void(0)">Sub menu</a></li>
  115.      <li><a href="javascript:void(0)">Sub menu</a></li>
  116.     </ul>
  117.    </li>
  118.    <br />
  119.    <li><a class="qmparent" href="javascript:void(0)">Resources & Links</a>
  120.     <ul>
  121.      <li><a href="http://www.architecture.com" target="_new">RIBA</a></li>
  122.      <li><a href="http://www.rias.org.uk" target="_new">RIAS</a></li>
  123.      <li><a href="http://www.carbontrust.co.uk" target="_new">Carbon Trust</a></li>
  124.     </ul>
  125.    </li>
  126.    <br />
  127.    <li><a class="qmparent" href="javascript:void(0)">Contact Us</a>
  128.    <li class="qmclear"></li>
  129.   </ul>
  130. <p><script type="text/javascript">qm_create(0,true,0,500,false,false,false,false,false);</script>
  131. </p>
  132. </div>
  133. <div id="quote">
  134.  <div align="center">
  135.   <p><img src="quotation.jpg" align="top" /></p>
  136.   </div>
  137. </div>
  138. <div id="content">
  139. ');
  140. }
  141. ?>


Las otras páginas no parecen ser relevantes para el problema en cuestión. Pensé que añadir el CSS completo, aunque dudo que añade mucho más a lo que ya he publicado...

Código: [ Select ]
.qmmc .qmdivider{display:block;font-size:1px;border-width:0px;border-style:solid;position:relative;z-index:1;}.qmmc .qmdividery{float:left;width:0px;}.qmmc .qmtitle{display:block;cursor:default;white-space:nowrap;position:relative;z-index:1;}.qmclear {font-size:1px;height:0px;width:0px;clear:left;line-height:0px;display:block;float:none !important;}.qmmc {position:relative;zoom:1;z-index:10;}.qmmc a, .qmmc li {float:left;display:block;white-space:nowrap;position:relative;z-index:1;}.qmmc div a, .qmmc ul a, .qmmc ul li {float:none;}.qmsh div a {float:left;}.qmmc div{visibility:hidden;position:absolute;}.qmmc li {z-index:auto;}.qmmc ul {left:-10000px;position:absolute;z-index:10;}.qmmc, .qmmc ul {list-style:none;padding:0px;margin:0px;}.qmmc li a {float:none}.qmmc li:hover>ul{left:auto;}#qm0 li {float:none;}#qm0 li:hover>ul{top:0px;left:100%;}

    #qm0    
    {
    width:160px;
    height: 302px;
    padding:0px 20px;
    margin-top:20px;
    background-color:transparent;
    border-width:0px;
    border-style:solid;
    border-color:#006699;
    }


    #qm0 a    
    {
    padding:3px 20px 3px 3px;
    background-color:transparent;
    color:#aaaaaa;
    font-family:Arial;
    font-size:12px;
    text-decoration:none;
    border-width:0px 0px 1px;
    border-style:solid;
    border-color:#aaaaaa;
    }


    #qm0 a:hover    
    {    
        color:#ffffff;
        border-color:#fff;
    }


    body #qm0 .qmactive, body #qm0 .qmactive:hover    
    {    
        color:#ffffff;
        border-color:#006699;
    }


    #qm0 div, #qm0 ul    
    {    
        padding:5px;
        background-color:transparent;
        border-width:0px;
        border-style:solid;
        border-color:#fff;
    }


    #qm0 div a, #qm0 ul a    
    {    
        padding:3px 20px 3px 5px;
        color: #cccccc;
        font-size:12px;
        border-width:0px;
        border-color:#fff;
    }


    #qm0 div a:hover, #qm0 ul a:hover    
    {    
        color:#fff;
        text-decoration:underline;
    }


    body #qm0 div .qmactive, body #qm0 div .qmactive:hover    
    {    
        color:#006699;
        text-decoration:underline;
    }

body {
    background-color:    #fff;
    font-family:Arial, Helvetica, sans-serif;
    font-size:16px;
    padding:0;
    margin:0;
}

div{
    margin:0;
    padding:0;
    /*width: 1060px;*/
    padding-right: 0px;
}
h1{margin:0;padding:0;}
h2{margin:0;padding:0;}
h3{margin:0;padding:0;}
p{
    margin:0;
    padding:0;
}
ul{margin:0;padding:0;}
li{list-style-type:none;}

#page_container{
    width:1060px;
    margin:0 auto;
}
#banner{
    background-color: #000;
    background-image: url(images/bannergrad.jpg);
    background-repeat: repeat-x;
    height:125px;
    padding-left: 0px;
}
#menu{
    width:300px;
    height:302px;
    float:none;
    padding-left:20px;
    padding-top:10px;
}


div#menu.color1
{
  background-color:#f00;
}


#image{
    background:#ECECEC;
    background-image: url(images/index.jpg);
    background-position:right;
    float:right;
    height: 312px;
    width: 740px;
}
#quote{
    background:#fff;
    height:55px;
    width:970px;
    border-top: 0px solid #000;
    border-bottom: 0px solid #000;
    padding-left: 40px;
    padding-top: 20px;
    padding-bottom: 20px;
}
    
#left_column{
    background:#ddd;
    width:550px;
    height:500px;
    float: left;
    padding-top: 50px;
    padding-left: 30px;
    padding-right: 30px;
    color: #006699
        
}

#right_column{
    background-color:#ccc;
    width:390px;
    height:500px;
    float: left;
    padding-top: 50px;
    padding-left: 30px;
    padding-right: 30px;
}

#mainbox{
    background:#ddd;
    width:960px;
    height:500px;
    float: left;
    padding-top: 50px;
    padding-left: 50px;
    padding-right: 50px;
    color: #006699
        
}

#footer{
    background-color: #000000;
    background-image: url(images/footer.jpg);
    background-repeat: repeat-x;
    height:30px;
    padding-left: 0px;
}

A:link {text-decoration: none;color:#fff;}
A:visited {text-decoration: none;color:#fff;}
A:active {text-decoration: none;color:#fff;}
A:hover {text-decoration: none; color:#ccc;}

.style1 {
    font-size: 12px
}

.style2 {
    font-size: 12px; color: #000000;
}

.style3 {
color: #000000;
}
  1. .qmmc .qmdivider{display:block;font-size:1px;border-width:0px;border-style:solid;position:relative;z-index:1;}.qmmc .qmdividery{float:left;width:0px;}.qmmc .qmtitle{display:block;cursor:default;white-space:nowrap;position:relative;z-index:1;}.qmclear {font-size:1px;height:0px;width:0px;clear:left;line-height:0px;display:block;float:none !important;}.qmmc {position:relative;zoom:1;z-index:10;}.qmmc a, .qmmc li {float:left;display:block;white-space:nowrap;position:relative;z-index:1;}.qmmc div a, .qmmc ul a, .qmmc ul li {float:none;}.qmsh div a {float:left;}.qmmc div{visibility:hidden;position:absolute;}.qmmc li {z-index:auto;}.qmmc ul {left:-10000px;position:absolute;z-index:10;}.qmmc, .qmmc ul {list-style:none;padding:0px;margin:0px;}.qmmc li a {float:none}.qmmc li:hover>ul{left:auto;}#qm0 li {float:none;}#qm0 li:hover>ul{top:0px;left:100%;}
  2.     #qm0    
  3.     {
  4.     width:160px;
  5.     height: 302px;
  6.     padding:0px 20px;
  7.     margin-top:20px;
  8.     background-color:transparent;
  9.     border-width:0px;
  10.     border-style:solid;
  11.     border-color:#006699;
  12.     }
  13.     #qm0 a    
  14.     {
  15.     padding:3px 20px 3px 3px;
  16.     background-color:transparent;
  17.     color:#aaaaaa;
  18.     font-family:Arial;
  19.     font-size:12px;
  20.     text-decoration:none;
  21.     border-width:0px 0px 1px;
  22.     border-style:solid;
  23.     border-color:#aaaaaa;
  24.     }
  25.     #qm0 a:hover    
  26.     {    
  27.         color:#ffffff;
  28.         border-color:#fff;
  29.     }
  30.     body #qm0 .qmactive, body #qm0 .qmactive:hover    
  31.     {    
  32.         color:#ffffff;
  33.         border-color:#006699;
  34.     }
  35.     #qm0 div, #qm0 ul    
  36.     {    
  37.         padding:5px;
  38.         background-color:transparent;
  39.         border-width:0px;
  40.         border-style:solid;
  41.         border-color:#fff;
  42.     }
  43.     #qm0 div a, #qm0 ul a    
  44.     {    
  45.         padding:3px 20px 3px 5px;
  46.         color: #cccccc;
  47.         font-size:12px;
  48.         border-width:0px;
  49.         border-color:#fff;
  50.     }
  51.     #qm0 div a:hover, #qm0 ul a:hover    
  52.     {    
  53.         color:#fff;
  54.         text-decoration:underline;
  55.     }
  56.     body #qm0 div .qmactive, body #qm0 div .qmactive:hover    
  57.     {    
  58.         color:#006699;
  59.         text-decoration:underline;
  60.     }
  61. body {
  62.     background-color:    #fff;
  63.     font-family:Arial, Helvetica, sans-serif;
  64.     font-size:16px;
  65.     padding:0;
  66.     margin:0;
  67. }
  68. div{
  69.     margin:0;
  70.     padding:0;
  71.     /*width: 1060px;*/
  72.     padding-right: 0px;
  73. }
  74. h1{margin:0;padding:0;}
  75. h2{margin:0;padding:0;}
  76. h3{margin:0;padding:0;}
  77. p{
  78.     margin:0;
  79.     padding:0;
  80. }
  81. ul{margin:0;padding:0;}
  82. li{list-style-type:none;}
  83. #page_container{
  84.     width:1060px;
  85.     margin:0 auto;
  86. }
  87. #banner{
  88.     background-color: #000;
  89.     background-image: url(images/bannergrad.jpg);
  90.     background-repeat: repeat-x;
  91.     height:125px;
  92.     padding-left: 0px;
  93. }
  94. #menu{
  95.     width:300px;
  96.     height:302px;
  97.     float:none;
  98.     padding-left:20px;
  99.     padding-top:10px;
  100. }
  101. div#menu.color1
  102. {
  103.   background-color:#f00;
  104. }
  105. #image{
  106.     background:#ECECEC;
  107.     background-image: url(images/index.jpg);
  108.     background-position:right;
  109.     float:right;
  110.     height: 312px;
  111.     width: 740px;
  112. }
  113. #quote{
  114.     background:#fff;
  115.     height:55px;
  116.     width:970px;
  117.     border-top: 0px solid #000;
  118.     border-bottom: 0px solid #000;
  119.     padding-left: 40px;
  120.     padding-top: 20px;
  121.     padding-bottom: 20px;
  122. }
  123.     
  124. #left_column{
  125.     background:#ddd;
  126.     width:550px;
  127.     height:500px;
  128.     float: left;
  129.     padding-top: 50px;
  130.     padding-left: 30px;
  131.     padding-right: 30px;
  132.     color: #006699
  133.         
  134. }
  135. #right_column{
  136.     background-color:#ccc;
  137.     width:390px;
  138.     height:500px;
  139.     float: left;
  140.     padding-top: 50px;
  141.     padding-left: 30px;
  142.     padding-right: 30px;
  143. }
  144. #mainbox{
  145.     background:#ddd;
  146.     width:960px;
  147.     height:500px;
  148.     float: left;
  149.     padding-top: 50px;
  150.     padding-left: 50px;
  151.     padding-right: 50px;
  152.     color: #006699
  153.         
  154. }
  155. #footer{
  156.     background-color: #000000;
  157.     background-image: url(images/footer.jpg);
  158.     background-repeat: repeat-x;
  159.     height:30px;
  160.     padding-left: 0px;
  161. }
  162. A:link {text-decoration: none;color:#fff;}
  163. A:visited {text-decoration: none;color:#fff;}
  164. A:active {text-decoration: none;color:#fff;}
  165. A:hover {text-decoration: none; color:#ccc;}
  166. .style1 {
  167.     font-size: 12px
  168. }
  169. .style2 {
  170.     font-size: 12px; color: #000000;
  171. }
  172. .style3 {
  173. color: #000000;
  174. }


Si alguien sería capaz de descubrir cualquier cosa que pueda ayudar a mí entonces estaría muy agradecido.

Gracias de nuevo parodia.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de Usuario
  • Registrado: May 22, 2004
  • Mensajes: 3415
  • Loc: Richland, WA
  • Status: Offline

Nota Marzo 9th, 2010, 7:43 pm

Su problema parece estar en su $ page_name matriz. El método que he suministrado para obtener el nombre de la página actual no devuelve el directorio.

Por ejemplo. Si su página se encuentra en http://yoursite.com/new/page. php el siguiente sería cierto:

page_handle $ = new / página
$ page_name = "página"

Así que para su $ page_name Puede cambiar el valor de la clave para no incluir el directorio o puede utilizar el page_handle $ variable como la clave de búsqueda.

Veo beneficios para ambos.
#define NULL (::rand() % 2)
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Marzo 9th, 2010, 7:43 pm

Publicar Información

  • Total de mensajes en este tema: 17 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 163 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC