Les archives de FluxBB.fr
Vous n'êtes pas identifié(e).
bonjour, je suis nouveau et j'ai petit pepin
,j'ai envie que mon header change en fonction de l'heure de la journée selon 4 tranche horaires :
tranche 1 (de 05h à 09h)=>header01
tranche 2 (de 09h à 17h)=>header02
tranche 3 (de 17h à 20h)=>header03
tranche 4 (de 20h à 05h)=>header04
j'utilise eradication comme style et voici le fichier eradication_cs
/****************************************************************/
/* 1. COULEURS DES FONDS ET DES TEXTES */
/****************************************************************/
/* 1.1 Couleur par défaut du fond et du texte */
BODY {BACKGROUND-COLOR: #5F0000}
.pun {COLOR: #000}
DIV.box, .pun BLOCKQUOTE, #adminconsole FIELDSET TH, .rowodd, .roweven {BACKGROUND-COLOR: #FFF}
DIV.codebox {background-color:#F1F1F1}
#adminconsole TD, #adminconsole TH {BORDER-COLOR: #F1F1F1}
#punwrap {
background-color: #FFF;
}
/* 1. 2 Couleurs de fond plus sombres */
TD.tc2, TD.tc3, TD.tcmod, #postpreview, #viewprofile DD, DIV.forminfo,
#adminconsole FIELDSET TD, DIV.blockmenu DIV.box, #adstats DD {BACKGROUND-COLOR: #F1F1F1}
/* 1.3 Couleurs de fonds et de texte des en-têtes principaux et de la barre de navigation */
.pun H2 #brdmenu {BACKGROUND-COLOR: #FFF; COLOR: #FF573B}
/* 1.4 Ligne d'en-tête des tableaux */
.pun TH {BACKGROUND-COLOR: #F1F1F1}
/* 1.5 Couleur du texte de la légende des champs */
.pun LEGEND {COLOR: #005CB1}
/* 1.6 Texte surligné pour différents éléments */
.pun DIV.blockmenu LI.isactive A, #posterror LI STRONG {COLOR: #333}
/* header background */
div.box #brdtitle {
margin:0;
padding:0;
background-color : #FFF;
width:800px;
background-image : url(../../img/eradication/header.gif);
position : block;
height : 179px;
border: 0;
color:#000;
text-align:center;
}
#brdmenu {
BACKGROUND-COLOR: #F1F1F1;
BACKGROUND-IMAGE: url(../../img/eradication/fondmenu.gif);
COLOR: #FFF}
.pun H2 {
BACKGROUND-COLOR: #FFF;
COLOR: #FFF;
background-image: url(../../img/eradication/h2.gif);
}
/****************************************************************/
/* 2. FOND ET TEXTE DES MESSAGES */
/****************************************************************/
/* 2.1 Ceci est le paramètrage des messages. */
DIV.blockpost DIV.box, DIV.postright, DIV.postfootright {BACKGROUND-COLOR: #FFF}
DIV.postright, DIV.postfootright {BORDER-LEFT-COLOR: #f1f1f1}
DIV.postleft, DIV.postfootleft, DIV.blockpost LABEL {BACKGROUND-COLOR: #F1F1F1}
/* 2.2 Fond pour les en-têtes des messages et couleur du texte pour le numéros des messages dans la page viewtopic */
DIV.blockpost H2 {BACKGROUND-COLOR: #F1F1F1}
DIV.blockpost H2 SPAN.conr {COLOR: #FFF}
/* 2.3 Ceci est la ligne au-dessus de la signature dans les messages. La couleur et le fond devraient être identique */
.pun HR {BACKGROUND-COLOR: #003B66; COLOR: #003B66}
/****************************************************************/
/* 3. COULEURS DES BORDURES */
/****************************************************************/
/* 3.1 Toutes les bordures externes */
DIV.box {BORDER-COLOR: #DADADA}
/* 3.2 Rends la bordure du haut des posts assortie avec la couleur utilisée pour les en-tête des posts */
DIV.blockpost DIV.box {BORDER-COLOR: #DADADA #DADADA #DADADA}
/* 3.3 Bordures internes des tableaux. Par défaut la couleur de TH est la même que celle du fond (en 1.4) et la bordure est donc invisible */
.pun TD {BORDER-COLOR: #DADADA}
.pun TH {BORDER-COLOR: #DADADA}
/* 3.4 Crée la bordure d'encart pour les blocs de citation, de code, et pour les blocs d'information des formulaires */
.pun BLOCKQUOTE, DIV.codebox, DIV.forminfo, DIV.blockpost LABEL {BORDER-COLOR: #ACA899 #FFF #FFF #ACA899}
/* 3.5 Les bordures par défaut des listes de champs vues par Gecko sont vraiment vilaines, alors ceci leur donne une couleur , sans intérférer avec celles d'IE qui sont plutôt jolies */
.pun DIV>FIELDSET {BORDER-COLOR: #DADADA}
/****************************************************************/
/* 4. COULEURS DES LIENS */
/****************************************************************/
/* 4.1 Ceci est la couleur par défaut de tous les liens */
.pun A:link, .pun A:visited {COLOR: #005E5F}
.pun A:hover {COLOR: #003E5F}
/* 4.2 Ceci est la couleur pour les liens dans les lignes d'en-tête de tableaux et dans la barre de navigation */
.pun H2 A:link, .pun H2 A:visited{COLOR: #FFF; FONT-SIZE: 12px}
#brdmenu A:link, #brdmenu A:visited {COLOR: #FFF}
.pun H2 A:hover{COLOR: #FFF}
#brdmenu A:hover {COLOR: #005E5F}
/* 4.3 Ceci est pour pour les sujet fermés et pour les liens importants (maintenance, signalements,... ) */
LI.postreport A:link, LI.postreport A:visited, TR.iclosed TD.tcl A:link, TR.iclosed TD.tcl A:visited {COLOR: #888}
LI.postreport A:hover, TR.iclosed TD.tcl A:hover {COLOR: #AAA}
LI.maintenancelink A:link, LI.maintenancelink A:visited {COLOR: #B42000}
LI.maintenancelink A:hover {COLOR: #B42000}
/****************************************************************/
/* 5. INDICATEURS DE STATUT DES MESSAGES */
/****************************************************************/
/* Ce sont les indicateurs de statut des messages qui apparaissent à la gauche de quelques tableaux.
.inew = nouveaux messages, .iredirect = forums de redirection, .iclosed = sujets fermés et .isticky = sujets épinglés. Par défaut seul .inew est différent du défaut.*/
DIV.icon {BORDER-COLOR: #E6E6E6 #DEDEDE #DADADA #E2E2E2}
TR.iredirect DIV.icon {BORDER-COLOR: #F1F1F1 #F1F1F1 #F1F1F1 #F1F1F1}
DIV.inew {BORDER-COLOR: #0080D7 #0065C0 #0058B3 #0072CA}Voila merci d'avance pour votre j'en ai vraiment besoin 
Hors ligne
Quand tu dis ton header, tu veux juste parler de changer la feuille de style suivant l'heure ?
Bon toute façon, si c'est ça, il faut plutôt se tourner du côté php. En css, tu pourras rien faire du tout pour changer le style en fonction de l'heure.
Au niveau de header.php :
Il faut changer :
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />en fonction de l'heure, donc ça pourrait donner :
<?php
$heure = date("H");
if ($heure>= 5 && $heure<9) {
$style_css = $pun_user['style'].'_01.css';
}
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'_02.css';
}
else if ($heure>=17 && $heure<20) {
$style_css = $pun_user['style'].'_03.css';
}
else {
$style_css = $pun_user['style'].'_04.css';
}
?>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style_css.'.css' ?>" />Hors ligne
déjà merci pour ton aide 
enfaite je veux que sa soit juste le header (l'image ) qui change en fonction de l'heure de la journée , excusez mon ignorance 
Dernière modification par choukri14 (05-03-2009 23:59:31)
Hors ligne
Etant donné que l'image affichée dans le header est précisée dans le fichier style, il te suffit de créer les 4 fichiers styles identiques (à partir de celui existants), et de changer l'adresse dans chaque fichier pour qu'il appelle la bonne image :
background-image : url(../../img/eradication/header.gif);Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne
ok je vais essayer et je vous rend la réponse
merci
Hors ligne
heu non ça ne fonctionne pas voici ce qu'il m'affiche
"parse error, unexpected T_STRING in d:\www\motsdit.com\htdocs\forum\header.php on line 89"
voici ce que j'ai fait:
_uploader les 4 images nommé header01,02,03,04
_suprimer le fichier eradication_cs.css et le remplacer par 4 fichier identique (seul modif au niveau de background-image : url(../../img/eradication/header01/02/03/04.gif)
_modifier le header.php
Dernière modification par choukri14 (06-03-2009 00:31:57)
Hors ligne
Remplace
<link rel="stylesheet" type="text/css" href="style/<?php echo $style_css.'.css' ?>" />par
<link rel="stylesheet" type="text/css" href="style/<?php echo $style_css ?>" />, tu te retrouvais avec deux fois l'extension .css avec le code donné plus haut.
Et si l'erreur est toujours là, donne-nous ce qu'il y a à cette ligne.
Dernière modification par fanf73 (06-03-2009 01:43:35)
Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne
Si l'idée est bonne, perso je ferai 5 feuilles de styles :
1 qui comprend tous les styles (sauf l'image à changer en question)
et 4 autres avec juste pour infos l'image à changer.
Soit 1 gros fichier CSS et 4 touts petits de quelques lignes seulement.
Hors ligne
toujours rien 
voici le header.php
<?php
/***********************************************************************
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // For HTTP/1.0 compability
// Load the template
if (defined('PUN_ADMIN_CONSOLE'))
$tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
else if (defined('PUN_HELP'))
$tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
else
$tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
// START SUBST - <pun_include "*">
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
{
if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
ob_start();
include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
$tpl_temp = ob_get_contents();
$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
ob_end_clean();
}
// END SUBST - <pun_include "*">
// START SUBST - <pun_content_direction>
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
// END SUBST - <pun_content_direction>
// START SUBST - <pun_char_encoding>
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
// END SUBST - <pun_char_encoding>
// START SUBST - <pun_head>
ob_start();
// Is this a page that we want search index spiders to index?
if (!defined('PUN_ALLOW_INDEX'))
echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
?>
<title><?php echo $page_title ?></title>
<?php
$heure = date("H");
if ($heure>= 5 && $heure<9) {
$style_css = $pun_user['style'].'eradication_cs01.css';
}
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'eradication_cs02.css;
}
else if ($heure>=17 && $heure<20) {
$style_css = $pun_user['style'].'eradication_cs03.css';
}
else {
$style_css = $pun_user['style'].'eradication_cs04.css';
}
?>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style_css ?>" />
<?php
if (defined('PUN_ADMIN_CONSOLE'))
echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
if (isset($required_fields))
{
// Output JavaScript to validate form (make sure required fields are filled out)
?>
<script type="text/javascript">
<!--
function process_form(the_form)
{
var element_names = new Object()
<?php
// Output a JavaScript array with localised field names
while (list($elem_orig, $elem_trans) = @each($required_fields))
echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace(' ', ' ', $elem_trans)).'"'."\n";
?>
if (document.all || document.getElementById)
{
for (i = 0; i < the_form.length; ++i)
{
var elem = the_form.elements[i]
if (elem.name && elem.name.substring(0, 4) == "req_")
{
if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
{
alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>")
elem.focus()
return false
}
}
}
}
return true
}
// -->
</script>
<?php
}
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
if (strpos($user_agent, 'msie') !== false && strpos($user_agent, 'windows') !== false && strpos($user_agent, 'opera') === false)
echo '<script type="text/javascript" src="style/imports/minmax.js"></script>';
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_head>
// START SUBST - <body>
if (isset($focus_element))
{
$tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main);
$tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main);
}
// END SUBST - <body>
// START SUBST - <pun_page>
$tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_title>
$tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_desc>
$tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);
// END SUBST - <pun_desc>
// START SUBST - <pun_navlinks>
$tpl_main = str_replace('<pun_navlinks>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_navlinks>
// START SUBST - <pun_status>
if ($pun_user['is_guest'])
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
else
{
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';
if ($pun_user['g_id'] < PUN_GUEST)
{
$result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
if ($db->result($result_header))
$tpl_temp .= "\n\t\t\t\t".'<li class="reportlink"><strong><a href="admin_reports.php">Il y a de nouveaux signalements</a></strong></li>';
if ($pun_config['o_maintenance'] == '1')
$tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><strong><a href="admin_options.php#maintenance">Le mode maintenance est activé !</a></strong></li>';
}
if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></li>'."\n\t\t\t\t".'<li><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
else
$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
}
$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
// END SUBST - <pun_status>
// START SUBST - <pun_announcement>
if ($pun_config['o_announcement'] == '1')
{
ob_start();
?>
<div id="announce" class="block">
<h2><span><?php echo $lang_common['Announcement'] ?></span></h2>
<div class="box">
<div class="inbox">
<div><?php echo $pun_config['o_announcement_message'] ?></div>
</div>
</div>
</div>
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
ob_end_clean();
}
else
$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
// END SUBST - <pun_announcement>
// START SUBST - <pun_main>
ob_start();
define('PUN_HEADER', 1);TLP je suis partant pour le gros fichier css et 4 tus petits de quelques lignes seulement mais faudrait m'expliquer en détails quel fichiers modifier 
merci à tous pour votre aide ,on va bien finir par trouver la solution 
Hors ligne
Il te manque une ' à la fin de la ligne 86
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'eradication_cs02.css';Ça se voit tout de suite sous certains éditeur de code du style notepad++.
Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne
merci je vais tester
Hors ligne
Bon alors j'arrive a accéder au forum mais tout est en blanc 
voici le header:
<?php
/***********************************************************************
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // For HTTP/1.0 compability
// Load the template
if (defined('PUN_ADMIN_CONSOLE'))
$tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
else if (defined('PUN_HELP'))
$tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
else
$tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
// START SUBST - <pun_include "*">
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
{
if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
ob_start();
include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
$tpl_temp = ob_get_contents();
$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
ob_end_clean();
}
// END SUBST - <pun_include "*">
// START SUBST - <pun_content_direction>
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
// END SUBST - <pun_content_direction>
// START SUBST - <pun_char_encoding>
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
// END SUBST - <pun_char_encoding>
// START SUBST - <pun_head>
ob_start();
// Is this a page that we want search index spiders to index?
if (!defined('PUN_ALLOW_INDEX'))
echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
?>
<title><?php echo $page_title ?></title>
<?php
$heure = date("H");
if ($heure>= 5 && $heure<9) {
$style_css = $pun_user['style'].'eradication_cs01.css';
}
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'eradication_cs02.css';
}
else if ($heure>=17 && $heure<20) {
$style_css = $pun_user['style'].'eradication_cs03.css';
}
else {
$style_css = $pun_user['style'].'eradication_cs04.css';
}
?>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style_css ?>" />
<?php
if (defined('PUN_ADMIN_CONSOLE'))
echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
if (isset($required_fields))
{
// Output JavaScript to validate form (make sure required fields are filled out)
?>
<script type="text/javascript">
<!--
function process_form(the_form)
{
var element_names = new Object()
<?php
// Output a JavaScript array with localised field names
while (list($elem_orig, $elem_trans) = @each($required_fields))
echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace(' ', ' ', $elem_trans)).'"'."\n";
?>
if (document.all || document.getElementById)
{
for (i = 0; i < the_form.length; ++i)
{
var elem = the_form.elements[i]
if (elem.name && elem.name.substring(0, 4) == "req_")
{
if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
{
alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>")
elem.focus()
return false
}
}
}
}
return true
}
// -->
</script>
<?php
}
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
if (strpos($user_agent, 'msie') !== false && strpos($user_agent, 'windows') !== false && strpos($user_agent, 'opera') === false)
echo '<script type="text/javascript" src="style/imports/minmax.js"></script>';
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_head>
// START SUBST - <body>
if (isset($focus_element))
{
$tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main);
$tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main);
}
// END SUBST - <body>
// START SUBST - <pun_page>
$tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_title>
$tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_desc>
$tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);
// END SUBST - <pun_desc>
// START SUBST - <pun_navlinks>
$tpl_main = str_replace('<pun_navlinks>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_navlinks>
// START SUBST - <pun_status>
if ($pun_user['is_guest'])
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
else
{
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';
if ($pun_user['g_id'] < PUN_GUEST)
{
$result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
if ($db->result($result_header))
$tpl_temp .= "\n\t\t\t\t".'<li class="reportlink"><strong><a href="admin_reports.php">Il y a de nouveaux signalements</a></strong></li>';
if ($pun_config['o_maintenance'] == '1')
$tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><strong><a href="admin_options.php#maintenance">Le mode maintenance est activé !</a></strong></li>';
}
if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></li>'."\n\t\t\t\t".'<li><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
else
$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
}
$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
// END SUBST - <pun_status>
// START SUBST - <pun_announcement>
if ($pun_config['o_announcement'] == '1')
{
ob_start();
?>
<div id="announce" class="block">
<h2><span><?php echo $lang_common['Announcement'] ?></span></h2>
<div class="box">
<div class="inbox">
<div><?php echo $pun_config['o_announcement_message'] ?></div>
</div>
</div>
</div>
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
ob_end_clean();
}
else
$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
// END SUBST - <pun_announcement>
// START SUBST - <pun_main>
ob_start();
define('PUN_HEADER', 1);Dernière modification par choukri14 (06-03-2009 14:29:03)
Hors ligne
Bon alors j'arrive a accéder au forum mais tout est en blanc
Oui enfin le CSS ne s'applique plus...
Hors ligne
Je viens de me rendre que le code que tu n'as pas collé ce qui t'a été donné. Compare le code donné Lyconide et ce que tu as dans ton header, tu verras des différences !
Mais ça ne résous pas ton problème. Pour que ça fonctionne bien essaie ça :
Ouvre ton fichier 'style/eradication.css' et supprime la ligne :
@import url(imports/eradication_cs.css);Et dans ton fichier header.php, remplace
<?php
$heure = date("H");
if ($heure>= 5 && $heure<9) {
$style_css = $pun_user['style'].'eradication_cs01.css';
}
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'eradication_cs02.css;
}
else if ($heure>=17 && $heure<20) {
$style_css = $pun_user['style'].'eradication_cs03.css';
}
else {
$style_css = $pun_user['style'].'eradication_cs04.css';
}
?>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style_css ?>" />
<?phppar
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
<?php
$heure = date("H");
if ($heure>= 5 && $heure<9) {
$style_css = $pun_user['style'].'_cs01.css';
}
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'_cs02.css';
}
else if ($heure>=17 && $heure<20) {
$style_css = $pun_user['style'].'_cs03.css';
}
else {
$style_css = $pun_user['style'].'_cs04.css';
}
?>
<link rel="stylesheet" type="text/css" href="style/imports/<?php echo $style_css ?>" />Dernière modification par fanf73 (06-03-2009 16:37:43)
Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne
Personellement j'aurais simplement géré le tout en PHP. Mettre dans le css l'image en php et ensuite un fichier image.php qui définit quel image afficher et le retourne. Tout simplement 
...
Hors ligne
ah j'ai compris mon erreur mais cette fois voici le message affiché
"Parse error: parse error, unexpected '}' in d:\www\motsdit.com\htdocs\forum\header.php on line 141"
voici le header:
<?php
/***********************************************************************
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // For HTTP/1.0 compability
// Load the template
if (defined('PUN_ADMIN_CONSOLE'))
$tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
else if (defined('PUN_HELP'))
$tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
else
$tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
// START SUBST - <pun_include "*">
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
{
if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
ob_start();
include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
$tpl_temp = ob_get_contents();
$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
ob_end_clean();
}
// END SUBST - <pun_include "*">
// START SUBST - <pun_content_direction>
$tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
// END SUBST - <pun_content_direction>
// START SUBST - <pun_char_encoding>
$tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
// END SUBST - <pun_char_encoding>
// START SUBST - <pun_head>
ob_start();
// Is this a page that we want search index spiders to index?
if (!defined('PUN_ALLOW_INDEX'))
echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
?>
<title><?php echo $page_title ?></title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
<?php
$heure = date("H");
if ($heure>= 5 && $heure<9) {
$style_css = $pun_user['style'].'_cs01.css';
}
else if ($heure>=9 && $heure<17) {
$style_css = $pun_user['style'].'_cs02.css';
}
else if ($heure>=17 && $heure<20) {
$style_css = $pun_user['style'].'_cs03.css';
}
else {
$style_css = $pun_user['style'].'_cs04.css';
}
?>
<link rel="stylesheet" type="text/css" href="style/imports/<?php echo $style_css.'.css' ?>" />
if (defined('PUN_ADMIN_CONSOLE'))
echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
if (isset($required_fields))
{
// Output JavaScript to validate form (make sure required fields are filled out)
?>
<script type="text/javascript">
<!--
function process_form(the_form)
{
var element_names = new Object()
<?php
// Output a JavaScript array with localised field names
while (list($elem_orig, $elem_trans) = @each($required_fields))
echo "\t".'element_names["'.$elem_orig.'"] = "'.addslashes(str_replace(' ', ' ', $elem_trans)).'"'."\n";
?>
if (document.all || document.getElementById)
{
for (i = 0; i < the_form.length; ++i)
{
var elem = the_form.elements[i]
if (elem.name && elem.name.substring(0, 4) == "req_")
{
if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
{
alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>")
elem.focus()
return false
}
}
}
}
return true
}
// -->
</script>
<?php
}
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
if (strpos($user_agent, 'msie') !== false && strpos($user_agent, 'windows') !== false && strpos($user_agent, 'opera') === false)
echo '<script type="text/javascript" src="style/imports/minmax.js"></script>';
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_head>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_head>
// START SUBST - <body>
if (isset($focus_element))
{
$tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus();', $tpl_main);
$tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').'.$focus_element[1].'.focus()">', $tpl_main);
}
// END SUBST - <body>
// START SUBST - <pun_page>
$tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_title>
$tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_desc>
$tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);
// END SUBST - <pun_desc>
// START SUBST - <pun_navlinks>
$tpl_main = str_replace('<pun_navlinks>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_navlinks>
// START SUBST - <pun_status>
if ($pun_user['is_guest'])
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
else
{
$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';
if ($pun_user['g_id'] < PUN_GUEST)
{
$result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
if ($db->result($result_header))
$tpl_temp .= "\n\t\t\t\t".'<li class="reportlink"><strong><a href="admin_reports.php">Il y a de nouveaux signalements</a></strong></li>';
if ($pun_config['o_maintenance'] == '1')
$tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><strong><a href="admin_options.php#maintenance">Le mode maintenance est activé !</a></strong></li>';
}
if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></li>'."\n\t\t\t\t".'<li><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
else
$tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
}
$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
// END SUBST - <pun_status>
// START SUBST - <pun_announcement>
if ($pun_config['o_announcement'] == '1')
{
ob_start();
?>
<div id="announce" class="block">
<h2><span><?php echo $lang_common['Announcement'] ?></span></h2>
<div class="box">
<div class="inbox">
<div><?php echo $pun_config['o_announcement_message'] ?></div>
</div>
</div>
</div>
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
ob_end_clean();
}
else
$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
// END SUBST - <pun_announcement>
// START SUBST - <pun_main>
ob_start();
define('PUN_HEADER', 1);merci
Hors ligne
m@x, c'est plus simple? comment faire ? va falloir être précis car là je galère
et encore fanf73 est patient avec moi 
Hors ligne
Dans ton css tu met l'adresse d'un fichier php (image_header.php à la racine de ton site par exemple) donc :
background-image : url(../../image_header.php);Et dans image_header.php :
<?php
$heure = date('H');
if ($heure >= 5 && $heure < 9)
$img = 'img/image_1.jpg';
else if ($heure >= 9 && $heure < 17)
$img = 'img/image_2.jpg';
else if ($heure >= 17 && $heure < 20)
$img = 'img/image_3.jpg';
else
$img = 'img/image_4.jpg';
header('Content-type: image/jpeg');
if(file_exist($img))
readfile($img);
?>Pas testé.
Dernière modification par M@x (06-03-2009 16:17:58)
...
Hors ligne
Rajoute
<?phpaprès
<link rel="stylesheet" type="text/css" href="style/imports/<?php echo $style_css.'.css' ?>" />ligne 96 (pour la solution que je te donnais).
D'ailleurs supprime dans cette ligne le
.'.css'Si tu essaies celle de M@x j'aimerais bien savoir si ça fonctionne, ça m'intéresse comme technique 
Dernière modification par fanf73 (06-03-2009 16:38:19)
Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne
bon ok j'ai essayé celle de m@x le forum s'affiche normalement mais pas d'image en header ,un vide blanc 
Dernière modification par choukri14 (06-03-2009 16:47:50)
Hors ligne
bravo fanf73 ta technique marche parfaitement ,vraiment bravo et merci a vous tous ;m@x,koka sans oublier Lyconide 
Hors ligne
je n'ai rien fait du tout moi 
Mais je t'en pris xD
Hors ligne
bon ok j'ai essayé celle de m@x le forum s'affiche normalement mais pas d'image en header ,un vide blanc
Tu as bien modifié les chemin et tout ? Parce que la solution est tout de même plus simple et plus "propre".
...
Hors ligne
heu pour répondre a m@x je pense que oui 
Hors ligne
Bonjour,
je suis bien content de trouver ce post car je voulais faire une modif un peu similaire, du genre GPS avec "mode jour et nuit" (entre 22h et 7h du mat
).
Du coup, il faut que je me mette dans les feuilles css, mais comme vous pouvez le constater ci-dessous sur cette simulation jour/nuit de mon forum, ma seconde feuille est exactement une inversion de la première
.
Pas de soucis, pour inverser les images, mais je me demandais s'il n'existait pas une moulinette pour générer l'inverse exact d'une feuille de style à partir d'un modèle ? Ce serait plus cool que de tout écrire à la mano avec des tonnes d'erreurs à la clef 
Si quelqu'un connait une bonne adresse, je suis preneur 

Hors ligne