IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

switch et inclusion


Sujet :

Langage PHP

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut switch et inclusion
    Bonjour,
    je débute en php. Cela fait maintenant 5 heures que je parcours le web mais rien n'a peu m'aider...
    Je me tourne donc vers vous pour vous demander votre aide...

    Voilà donc mon problème, je voudrais faire un site ou seul la partie centrale est rafraichi car je compte créer une anim flash en entete et intégrer un musique avec bouton on/off .

    Je ne veux pas faire d'iframe car c'est de la me****
    J'ai donc vu que le php et l'include était une solution (peut etre pas la meilleur d'ailleurs).

    Bref nous voilà au problème. Mon code fonctionne mais seulement lorsque mes liens sont en toute lettre !
    Je m'explique en images : http://www.b-website.com

    Le lien au centre renvoi bien sur la page artwork...

    En revanche vous avez pu constater que les liens du menu ne fonctionne pas !
    Pourtant leurs cibles sont les mêmes...

    je pense que le problème vient de mon imbrication dans les frame et que mes valeur 0, 1, 2, etc ne sont pas collectées par mon $_GET. Du moins c'est ce que je pense avoir compris...

    Je vous met mon code:

    index.php

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    	<title>Portfolio by Brisso</title>
     
    	<link rel="stylesheet" href="css/CSS.css" type="text/css" />
     
    	<script type="text/javascript" src="js/jquery.js" ></script>
    	<script type="text/javascript" src="js/jquery-bp.js" ></script>
    	<script type="text/javascript" src="js/navigation.js" ></script>
     
    </head>
    <body>
     
    	<?php include('menu.php'); ?>
     
        <a href="?page=1">Lien en toutes lettres !!!!!!!!</a>	
     
         <div class="container">
    		<div class="content">
    			<div id="content-title">
        <?php
        if (isset($_GET["page"])) $page = $_GET["page"];
        else $page = 0;
        switch ($page) {
            case 1 : include("artwork.php"); break;
            case 2 : include("photos.php"); break;
    	case 3 : include("curiculum.php"); break;
    	case 4 : include("contact.php"); break;		
            default : include("accueil.php"); break;
        }
     
    ?> 
     
    		   </div>
    		</div>
    	</div>
    </body>
    et menu.php d'où vient mon problème je pense!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <div id="header">!!!!! mon futur flash !!!!</div>
    <div id="navigation" class="container">
    		<div id="index" class="pri-nav active"><div><a href="?page=0"></a></div></div>												
    		<div id="artwork" class="pri-nav"><div><a href="?page=1"></a></div></div>
    		<div id="photos" class="pri-nav"><div><a href="?page=2"></a></div></div>
    		<div id="curiculum" class="pri-nav"><div><a href="?page=3"></a></div></div>
    		<div id="contact" class="pri-nav"><div><a href="?page=4"></a></div></div>
    </div>
    Merci par avance

  2. #2
    Membre expérimenté

    Profil pro
    Étudiant
    Inscrit en
    Août 2009
    Messages
    130
    Détails du profil
    Informations personnelles :
    Âge : 34
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Août 2009
    Messages : 130
    Par défaut
    Salut,

    dans ton menu.php, essaie de mettre les href comme ca :
    href="index.php?page=1"

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut
    merci pour ta réponse mais malheureusement il n'y a aucun changement.

  4. #4
    Membre Expert
    Avatar de Eric2a
    Homme Profil pro
    Technicien
    Inscrit en
    Septembre 2005
    Messages
    1 225
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Corse (Corse)

    Informations professionnelles :
    Activité : Technicien

    Informations forums :
    Inscription : Septembre 2005
    Messages : 1 225
    Par défaut
    Salut,

    Tes fichiers à inclure de doivent pas comporter de déclaration de type de document (DOCTYPE), de balise html, head, meta, title et body.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    ...
    			<div id="content-title">
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Document sans nom</title>
    </head>
    test accueil
    <body>
    </body>
    </html> 
               <a href="?page=1">Lien en toutes lettres !!!!!!!!</a>
    
    Ne met que l'essentiel ici
    
    		   </div>
    ...
    Ensuite la déclaration de index.php n'est pas bonne. Utilise plutôt celle-ci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    Je pense que tes scripts en Javascript y verrons plus clair.

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut
    merci de me répondre si tard mais toujours rien de nouveau...sniff

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut
    Bonjour, ignorant comme je suis je me suis dit que le php4 y changerait peut-être quelque chose mais non...

  7. #7
    Modérateur
    Avatar de Vil'Coyote
    Homme Profil pro
    Développeur adélia & Web
    Inscrit en
    Février 2008
    Messages
    4 583
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur adélia & Web
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2008
    Messages : 4 583
    Par défaut
    quand tu clic sur artwork

    tu récupère le lien : http://www.b-website.com/artwork

    donc ce n'est pas un problème côté php. le lien utiliser n'est pas celui contenu dans le <a></a> regarde dans jquery
    la vie n'est pas cirrhose des foies ...

    Avant de poster un message Rechercher n'est pas qu'une option.
    FAQ Web - Tuto Web

  8. #8
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut
    merci également pour ta réponse. J'ai constater la meme chose et j'ai déjà parcouru le jquery et je n'ai rien trouvé. En meme temps je ne connais pas du tout ce langage. Voici le code.

    jquery-bp.js

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    /**
     * @author Alexander Farkas
     * v. 1.02
     */
    (function($) {
    	$.extend($.fx.step,{
    	    backgroundPosition: function(fx) {
                if (fx.state === 0 && typeof fx.end == 'string') {
                    var start = $.curCSS(fx.elem,'backgroundPosition');
                    start = toArray(start);
                    fx.start = [start[0],start[2]];
                    var end = toArray(fx.end);
                    fx.end = [end[0],end[2]];
                    fx.unit = [end[1],end[3]];
    			}
                var nowPosX = [];
                nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
                nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
                fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
     
               function toArray(strg){
                   strg = strg.replace(/left|top/g,'0px');
                   strg = strg.replace(/right|bottom/g,'100%');
                   strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
                   var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
                   return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
               }
            }
    	});
    })(jQuery);
    navigation.js

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    var site_url = '';
    var nav  = [ '#index', '#artwork', '#photos', '#curiculum', '#contact' ];
     
    $(document).ready(function(){
    	setBkgPos();
     
    	for ( i = 0; i < nav.length; i++ ) {
    		$(nav[i]).bind( 'mouseover', mMouseOver );
    		$(nav[i]).bind( 'mouseout', mMouseOut );
    		$(nav[i]).bind( 'click', mClick );
    	}
     
    	for ( i = 0; i < nav.length; i++ ) {
    		// element with ‘active’ class will  start animation 
    		if ( $(nav[i]).get(0).className.indexOf('active') >= 0 ){
    			$(nav[i])
    				.animate({ backgroundPosition:'(' + _getHPos( nav[i] ) +'px -30px}'},"fast",
    					function(){ 
    						$(this)
    							.children()
    								.animate({backgroundPosition:'(0px -40px)'},20)
    								.animate({backgroundPosition:'(0px -20px)'},"fast");
    						$(this)
    							.animate({backgroundPosition:'(' + _getHPos( nav[i] ) +'px 50px)'},"fast")
    							.animate({backgroundPosition:'(' + _getHPos( nav[i] ) +'px 25px)'},"fast");
    						var parent = this;
    						$(this)
    							.children()
    								.animate( {backgroundPosition:'(0px -45px)'},"fast",function(){
    											$(parent).animate({backgroundPosition:'(' + _getHPos( parent.id ) +'px 25px)'},"fast");
    											$(parent).css({backgroundImage: 'url(img/nav.png)'});
    									});
    					});
    			break;
    		}
    	}
    }); 
     
    function _getHPos( id )
    {
    	for ( i = 0; i < nav.length; i++ ){
    		if ( '#' + id == nav[i] ){
    			return i*(-98);
    		}
    	}	
     
    	return 0;
    }
     
    function setBkgPos()
    {
    	for ( i = 0; i < nav.length; i++ ){
    		$(nav[i]).css({backgroundPosition: i*(-98) + 'px -25px'});
    		$(nav[i] + ' div').css({ backgroundPosition: '0px -60px'});
    	}
    }
     
    function mMouseOver(e)
    {
    	// element with ‘active’ class will ignore this event and do nothing
    	if ( this.className.indexOf('active') >= 0  ){
    		return;
    	}
     
    	$(this)
    		// stop any animation that took place before this
    		.stop()
    		// step 1. change the image file
    		.css({backgroundImage: 'url(img/nav-over.png)',cursor: 'pointer'})
    		// step.2 move up the navigation item a bit
    		.animate({ backgroundPosition:'(' + _getHPos( this.id ) +'px -30px}'},"fast",
    			// this section will be executed after the step.2 is done
    			function(){ 
    				$(this)
    					.children()
    						// step. 3 move the white box down
    						.animate({backgroundPosition:'(0px -40px)'},20)
    						// step 4. move the white box down
    						.animate({backgroundPosition:'(0px -20px)'},"fast");
    				$(this)
    					// step 4. move the navigation item down
    					.animate({backgroundPosition:'(' + _getHPos( this.id ) +'px 50px)'},"fast")
    					// step 5. move the navigation item to its final position
    					.animate({backgroundPosition:'(' + _getHPos( this.id ) +'px 25px)'},"fast");
    				// store the parent element id for later usage
    				var parent = this;
    				$(this)
    					.children()
    						// step 5. move the white box to its final position
    						.animate( {backgroundPosition:'(0px -45px)'},"fast",
    							// this section will be executed after the step.5 is done
    							function(){
    								// step.6 change the image to its original image	
    								$(parent).css({backgroundImage: 'url(img/nav.png)'});
    							});
     
    			});
    }
     
    function mMouseOut(e)
    {			
    	// element with ‘active’ class will ignore this event and do nothing
    	if ( this.className.indexOf('active') >= 0  ){
    		return;
    	}
     
    	$(this)
    		// stop any animation that took place before this
    		.stop()
    		// step.1 move down navigation item
    		.animate({backgroundPosition:'(' + _getHPos( this.id ) +'px 40px )'}, "fast", 
    			// this section will be executed after the step.1 is done
    			function(){
    				// step.2 white box move really fast
    				$(this).children().animate({backgroundPosition:'(0px 70px)'}, "fast");
    				// step 3. move navigation item up
    				$(this).animate( {backgroundPosition:'(' + _getHPos( this.id ) +'px -40px)'}, "fast", 
    					// this section will be executed after the step.3 is done
    					function(){
    						// step 4. move navigation item ot its original position
    						$(this).animate( {backgroundPosition:'(' + _getHPos( this.id ) +'px -25px)'}, "fast",
    							// this section will be executed after the step.4 is done
    							function(){
    								// move white box to its original position, ready for next animation
    								$(this).children().css({ backgroundPosition:'0px -60px'});
    							})
    					})
    			})
    		.css({backgroundImage: 'url(img/nav.png)', cursor: ''});
    }
     
    function mClick(e)
    {
    	location.href = this.id;
    }
    Et là le jquery.js mais je pense que celui sert de bibliothèque donc qu'il n'a rien d'important. N'étant pas sur je vous le montre quand mm.

    http://www.b-website.com/js/jquery.js

    Merci encore !

  9. #9
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut
    après plusieurs tests il semblerait que le script de mon menu ne supporte pas le .php ...
    quelqu'un aurrait il une idée ?

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    186
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 186
    Par défaut
    Bon finalement contournement du problème...
    utilisation d'APASH HTTP avec un .htaccess

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <Files .htaccess>
    	order allow,deny
    	deny from all
    </Files>
    <IfModule mod_alias.c>
    	Redirect permanent /index http://www.b-website.com/index.php
    	Redirect permanent /artwork http://www.b-website.com/artwork.php
    	Redirect permanent /photos http://www.b-website.com/photos.php
    	Redirect permanent /curiculum http://www.b-website.com/curiculum.php
    	Redirect permanent /contact http://www.b-website.com/contact.php
     
    </IfModule>
    Ca marche mais j'ai du, du coup, oublier mon idée du header statique et de la page dynamique...

    Dommage...
    Si quelqu'un trouve la solution, merci de penser à moi !

Discussions similaires

  1. Appel à des fonctions incluses dans des DLL
    Par Greybird dans le forum Langage
    Réponses: 3
    Dernier message: 26/05/2003, 13h33
  2. Réponses: 6
    Dernier message: 26/01/2003, 13h45
  3. Inclusion de fichier .h
    Par Tony49 dans le forum C++Builder
    Réponses: 2
    Dernier message: 06/11/2002, 11h10
  4. Générer un nombre aléatoire entre 0 et 1 (INCLUS !!!)
    Par haypo dans le forum Algorithmes et structures de données
    Réponses: 3
    Dernier message: 22/08/2002, 16h30
  5. Inclusion de fichiers en IDL
    Par babou dans le forum CORBA
    Réponses: 10
    Dernier message: 30/07/2002, 16h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo