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

JavaScript Discussion :

Rowspan dynamique avec PHP et Javascript


Sujet :

JavaScript

  1. #1
    Membre régulier Avatar de HWICE
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    249
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 249
    Points : 104
    Points
    104
    Par défaut Rowspan dynamique avec PHP et Javascript
    Bonjour
    J'aimerai savoir si on peut faire un count en javascript pour le mettre dans un script php. J'ai besion davoir un rowspan dynamique. voici mon code
    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
    <table width="100%"> <?  require_once "classes/wine.class.php"; 
                        $X=new vin();
     
     $x=$X->showwinesectvinc();
    foreach ($x as $sectc) { 
    ?><tr>
                <td colspan="4"><h1 align="center" class="vintitreT"><?=$sectc['section']?>
                </h1></td>
            </tr><?
             $x=$X->showwinesect($sectc['section']);
            foreach ($x as $sect) {
            if ($sect['ssection'] !=''){
        $i=1;
    ?>
    <tr>
                <td rowspan="<? echo $i;?>"><h2 class="vintitreT"><?=$sect['ssection']?>
                </h2></td>
     
    <? }
     
    $x=$X->showwinescat($sectc['section'],$sect['ssection']);
        foreach ($x as $scat) {
     
     
        $x=$X->showwinebyss($scat['scat'],$sectc['section'], $sect['ssection']);
     
    foreach ($x as $vin) {
     
    $i++;
      ?>  
     
                <td class="tabnom"><p class="vinnom"><?=$vin['nom']?><? if ($vin['scat'] != ''){?>&nbsp;&nbsp;<em class="default"><? echo $vin['scat']?></em><? }?></p></td>
                <td class="tabmille"><?=$vin['annee']?></td>
                <td class="tabprix"><?=$vin['prixbout']?>&nbsp;$</td>
     
    <? echo "</tr>";}}} }?></table>
    En php je ne peux pas le faire pcq le rowspan est plus haut et le count(plus le $i++) c'est fait plus bas

    merci de votre aide

  2. #2
    Membre régulier Avatar de HWICE
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    249
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 249
    Points : 104
    Points
    104
    Par défaut
    le code généré est
    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
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    <table width="100%"> <tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Rouge            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Bordeaux            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Château LaGarde (demi-bouteille)</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">31&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Réserve du Baron Montesquieu</p></td>
                <td class="tabmille">2003</td>
                <td class="tabprix">36&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Château Nenine</p></td>
                <td class="tabmille">2003</td>
                <td class="tabprix">43&nbsp;$</td>
     
    </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Autre            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Merlot&nbsp;&nbsp;<em class="default">Esser Napa Valley Californie</em></p></td>
                <td class="tabmille"></td>
                <td class="tabprix">45&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Pelazzo Al Campo&nbsp;&nbsp;<em class="default">Toscana Italie</em></p></td>
                <td class="tabmille"></td>
                <td class="tabprix">41&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Shardana&nbsp;&nbsp;<em class="default">Sardaigne Italie</em></p></td>
                <td class="tabmille">2003</td>
                <td class="tabprix">69&nbsp;$</td>
     
    </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Beaujolais            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Brouilly DuBoeuf (bouteille 500ml)</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">35&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Beaujolais Collin Bourisset</p></td>
                <td class="tabmille">2005</td>
                <td class="tabprix">38&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Moulin-à-Vent des Hospices</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">55&nbsp;$</td>
     
    </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Bourgogne            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Pinot Noir</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">40&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Haute Côtes de Beaunes</p></td>
                <td class="tabmille">2004</td>
                <td class="tabprix">45&nbsp;$</td>
     
    </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Rhône            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Châteauneuf-du-Pape&nbsp;&nbsp;<em class="default">Domaine du vieux lazaret</em></p></td>
                <td class="tabmille"></td>
                <td class="tabprix">65&nbsp;$</td>
     
    </tr><tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Porto            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Portugal            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Porto 20 ans</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">0&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Porto 10 ans</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">0&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Porto Blanc</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">0&nbsp;$</td>
     
    </tr><tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Pétillant            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Champagne            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Sieur d'arques</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">45&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Paul Goerg</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">99&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Veuve Clicquot Brut</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">99&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Moet et Chandon</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">99&nbsp;$</td>
     
    </tr><tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Blanc            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Alsace            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Pinot Gris Pfaffenheim</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">39&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Gewurztraminer Cuvée Bacchus</p></td>
                <td class="tabmille">2005</td>
                <td class="tabprix">49&nbsp;$</td>
     
    </tr><tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Rosé            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Provence            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Château Roseline</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">40&nbsp;$</td>
     
    </tr><tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Doux            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Languedoc            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">La Croix Chaptal&nbsp;&nbsp;<em class="default">Rouge</em></p></td>
                <td class="tabmille">2001</td>
                <td class="tabprix">55&nbsp;$</td>
     
    </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Monbazillac            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Château La Croix Poulvère</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">60&nbsp;$</td>
     
    </tr><tr>
                <td colspan="4"><h1 align="center" class="vintitreT">Whisky            </h1></td>
            </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Écosse            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Oban</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">0&nbsp;$</td>
     
    </tr>  
     
                <td class="tabnom"><p class="vinnom">Glenfiddich</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">9&nbsp;$</td>
     
    </tr><tr>
                <td rowspan="1"><h2 class="vintitreT">Irlande            </h2></td>
     
     
     
                <td class="tabnom"><p class="vinnom">Jameson</p></td>
                <td class="tabmille"></td>
                <td class="tabprix">0&nbsp;$</td>
     
    </tr></table>

  3. #3
    Membre émérite
    Inscrit en
    Septembre 2002
    Messages
    2 307
    Détails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    Points : 2 814
    Points
    2 814
    Par défaut
    Citation Envoyé par HWICE Voir le message
    En php je ne peux pas le faire pcq le rowspan est plus haut et le count(plus le $i++)
    Crée un tableau pour sauvegarder les données avant, puis calcule. et enfin l'affiche!

  4. #4
    Membre régulier Avatar de HWICE
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    249
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 249
    Points : 104
    Points
    104
    Par défaut
    mais exist-il un moyen de faire un count avec javascript et de faire une un rowspan dynamique
    <td rowspan="$i">

  5. #5
    Membre émérite
    Inscrit en
    Septembre 2002
    Messages
    2 307
    Détails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    Points : 2 814
    Points
    2 814
    Par défaut
    <table id="myTable">
    <tr>
    <td>
    ...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    montableau=document.getElementById("myTable");
    mesLignes=montableau.getElementsbytagname("tr");//array
    nombreLignes=mesLignes.length

Discussions similaires

  1. [Conception] Conception site web dynamique avec php
    Par windowsxx2001 dans le forum Langage
    Réponses: 2
    Dernier message: 31/03/2007, 17h54
  2. Forumulaire dynamique avec PHP (sélection)
    Par randriamanana dans le forum Langage
    Réponses: 3
    Dernier message: 05/01/2007, 14h03
  3. [Tableaux] Tableau dynamique avec php
    Par Ricus28 dans le forum Langage
    Réponses: 3
    Dernier message: 01/08/2006, 22h46
  4. Réponses: 5
    Dernier message: 13/04/2006, 19h51
  5. [XSLT] Création de fichier XML dynamique avec PHP
    Par daninho dans le forum Bibliothèques et frameworks
    Réponses: 10
    Dernier message: 02/02/2006, 11h18

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