nav changement de page automatique

  • SB
  • Moderator
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 8th, 2010, 11:17 am

Est-il possible d'utiliser PHP code semblable au suivant pour que chaque page de récupérer certaines informations à partir d'une feuille de style en cascade, qui seraient utilisés pour changer la couleur de fond de la barre de navigation de site Web?

Code: [ 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!"; }


S'il est possible, quelqu'un pourrait me renseigner sur comment je me prendrait pour atteindre ce que c'est?

Merci
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Mars 8th, 2010, 11:17 am

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 2:56 pm

Essayez-vous de faire en sorte que votre visite d'une page les changements de couleur d'arrière-plan de navigation?

Exemple:

http://wazzutke.com
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 8th, 2010, 3:02 pm

Je suis en fait de ne pas voir tous les changements en ce que, mais je crois que vous me comprenez.

Le site i am travaille actuellement sur -- http://www.campbell-james.co.uk/new/template.php - Est construite là où j'ai le code php dont 2 pages sur chaque page. La première page édifie la première moitié du code du site et la deuxième page s'accumule au second semestre. Je pensais ce fait beaucoup de sens pour créer un site qui aura à terme une grande quantité de pages.

En raison de la manière dont le site a été conçu, l'intention était d'avoir la zone de navigation bleue pour modifier la couleur sur chaque page il charge. C'est ce que j'avais espéré à faire et j'ai pensé qu'il serait possible de le faire en utilisant un code similaire à celui que j'ai posté ci-dessus.
  • SB
  • Moderator
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 8th, 2010, 3:59 pm

Je me demandais aussi s'il y avait moyen d'avoir une image pour l'ouvrir à partir d'un dossier pour chaque page en utilisant le même type de code ci-dessus?

J'ai pensé qu'il serait relativement facile à comprendre, mais ma connaissance de PHP n'est pas aussi vaste que je préfère.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 4:27 pm

Bon, vous souhaitez que la zone bleue à changer les couleurs en fonction de ce page est vue en cours. Correct?

Votre code actuel est sur la bonne voie. Ce que je suggère, c'est de créer un tableau de vos pages.

PHP Code: [ 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];


Je voudrais donc créer des classes de style ou ids si, pour chaque page. Vous pouvez même utiliser seulement les couleurs.

Code: [ Select ]
'pageName'=>'blue',


CSS Code: [ Select ]
.blue {
background-color: #0000FF;
}
  1. .blue {
  2. background-color: #0000FF;
  3. }
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 8th, 2010, 4:33 pm

Merci Spoof.

Ce que je suis pas sûr de bien ici, c'est comment je fais ce être spécifique à un peu la barre de navigation?
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 4:50 pm

Pour votre menu, je voudrais ajouter une catégorie à elle.

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


Utilisez ce style pour appliquer la couleur.

Pour limiter le style pour fonctionner uniquement avec le menu:
CSS Code: [ 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 l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 5:05 pm

Voici un exemple rapide que j'ai fait.

Code: [ 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>


Une chose est que vous devez retirer le background-color attribut de votre #menu la classe ne sera pas sur le droit d'elle.

Remarquez aussi j'ai changé la façon dont je obtenir le nom du fichier.
PHP Code: [ 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 l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 8th, 2010, 5:13 pm

Merci Spoof.

Je suis effectivement d'avoir des démêlés avec la CSS sur la barre de navigation qui est à l'origine du problème.

Votre aide nous a été très appréciée. Avec le temps un peu plus de malades ont le reste sussed je l'espère.

Merci beaucoup.
  • SB
  • Moderator
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 8th, 2010, 5:41 pm

Bon, alors voici ce que Ive a obtenu...

Code: [ 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];


Dans ma page index.php. Inférieur à celui de l'i navigation ont...

Code: [ 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>


Dans le i CSS ont...

Code: [ 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. }


J'ai enlevé la couleur de fond dans la partie du menu.

Il semble que la page PHP ne reconnaît pas le code CSS de la feuille CSS je avoir. Le code CSS actuelle se fait sur une page CSS séparée.

Pas tout à fait sûr de ce qui se passe vraiment mal ici comme je l'ai fait everthing vous mentionnez.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 5:52 pm

Je voudrais d'abord vérifier si $ page_name est ce que votre m'y attendais pas à être. Ajouter un echo ou print pour voir ce qu'il soit réglé. Vous pouvez également vérifier juste votre source et voir ce nom du style est en cours d'impression pour la classe. Si son impression de la bonne classe alors son un problème avec le CSS.

Pour troubler tirer sur le css, je ferais disparaître la div #menu et rend la classe mondiale.
#define NULL (::rand() % 2)
  • SB
  • Moderator
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 9th, 2010, 5:58 pm

:lol:

Je suis bel et bien perdu ici. Moyen de sortir de ma profondeur.

Examiné ce problème pour un peu de temps aujourd'hui, et n'ayant aucune chance à tous.

Votre aide nous a été formidable Spoof, donc je crois que cela. J'ai le sentiment que tout cela est quelque chose a à voir avec la façon dont le site a été construit, bien que je ne peux pas comprendre pourquoi. Je suis à court de cheveux pour sortir! :evil:
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 9th, 2010, 6:48 pm

Votre serveur peut-être pas le support de PHP code abrégé. J'ai regardé votre source et quelques-uns des PHP est pas reconnu.

Code: [ 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">


Vous pourriez avoir à faire quelque chose comme ceci:

Code: [ 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 l’utilisateur
  • Inscription: Nov 16, 2004
  • Messages: 8685
  • Loc: Aberdeen, Scotland
  • Status: Offline

Message Mars 9th, 2010, 7:05 pm

Merci. Toujours pas de chance à tous.

J'étais un peu réticent à mettre le code complet ici, mais si il n'y a aucune façon une personne peut comprendre ce que mai est l'origine du problème alors je vous serais extrêmement reconnaissant.

Comme je disais le site est construit en utilisant 2 documents principaux pour construire la présentation générale du site. Il s'agit de la première partie de la page que j'ai changé pour but ozzu seulement à «include1"

Code: [ 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. ?>


Les autres pages ne semblent pas être pertinents pour le problème en main. Je vais bien ajouter le CSS complet, même si je doute que cela ajoute beaucoup à ce que j'ai déjà posté...

Code: [ 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 quelqu'un veut être en mesure de comprendre tout ce qui mai m'aider alors je serais très reconnaissant.

Merci encore Spoof.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 9th, 2010, 7:43 pm

Votre problème semble être dans votre $ page_name tableau. La méthode que je fournis pour obtenir le nom de la page courante ne retourne pas le répertoire.

Par exemple. Si votre page a été localisé à http://yoursite.com/new/page. php les activités suivantes seront remplies:

$ page_handle = new / page
$ page_name = "page"

Donc, pour votre $ page_name vous pouvez soit modifier la valeur de clé de ne pas inclure le répertoire ou vous pouvez utiliser le $ page_handle variable en tant que votre clé de recherche.

Je vois des avantages aux deux.
#define NULL (::rand() % 2)
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Mars 9th, 2010, 7:43 pm

Afficher de l'information

  • Total des messages de ce sujet: 17 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 109 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC