altod Inviato 26 Ottobre 2010 Segnala Condividi Inviato 26 Ottobre 2010 Ciao a tutti! Apro questo topic sperando nell'aiuto di qualcuno... visto che da altre parti (forum dedicati) non ho risposte. Sto realizzando un sito con Joomla e utilizzo il componente JoomLeague per la gestione di campionato di basket. Vorrei fare una modifica al codice di una pagina, ovvero quella della visualizzazione del roster della squadra ordinata non per RUOLO (position) come impostato ma per numeri di maglia (position_number). Allego il codice della pagina.... <?php // Display players if ( count( $rows > 0 ) ) { ?> <table width="85%" align="center" border="0" cellpadding="3" cellspacing="0"> <?php $k = 0; $position = ""; for ($i=0, $n=count( $rows ); $i < $n; $i++) { $row = &$rows[$i]; // Display position separator ? if ( $position != $row->position ) { $position = $row->position; $k = 0; ?> <tr class="sectiontableheader"> <td width="60%" colspan="<?php echo ((isset($showPlayers_config['show_birthday']) && $showPlayers_config['show_birthday'] == 1) ? '6' : '5'); ?> "> </td> <?php if ($showPlayers_config['show_stats']==1) { if ( $overall_config['use_jl_substitution'] == 1 ) { if ( $showPlayers_config['show_games_played'] ) { ?> <td align="center"><img src="<?php echo JL_TEMPLATE_FOLDERS_URL.'/images/shirt.png';?>" height="20" alt="<?php echo _JL_PLAYER_PLAYED; ?>" /> </td> <?php } if ( $showPlayers_config['show_substitution_stats'] ) { ?> <td align="center"><img src="<?php echo JL_TEMPLATE_FOLDERS_URL.'/images/in.png';?>" alt="<?php echo _JL_PLAYER_IN;?>" /></td> <td align="center"><img src="<?php echo JL_TEMPLATE_FOLDERS_URL.'/images/out.png';?>" alt="<?php echo _JL_PLAYER_OUT;?>" /></td> <?php } } if (isset($PosEventtypes[$row->position_id]) && $overall_config['use_jl_events']) if ( count($PosEventtypes[$row->position_id]) ) { foreach ($PosEventtypes[$row->position_id] AS $eventtype) { echo '<td align="center"><img src="'._JOOMLA_JL_LIVE_SITE.'/images/joomleague/event_icons/'.$eventtype->icon.'" alt="'.$eventtype->name.'" title="'.$eventtype->name.'" align="top" hspace="2" /></td>'; } } } ?> </tr> <?php } // Display players rows ?> <tr class="<?php echo ($k == 0)? 'sectiontableentry1' : 'sectiontableentry2'; ?>"> <td width="30" align="center"> <?php if ( $showPlayers_config['show_player_numbers'] == 1 ) { if ($showPlayers_config['player_numbers_pictures']==1 && function_exists('imagecreatefrompng')) { ?> <img src="<?php echo JL_TEMPLATE_FOLDERS_URL;?>/images/shirt.php?text=<?php echo ($row->position_number!=0) ? $row->position_number : '';?>" alt="<?php echo $row->position_number;?>" /> <?php } else { echo ($row->position_number!='') ? $row->position_number : ' '; } } else echo ' '; ?> </td> <td width="100"> <?php echo $position; ?> </td> <td width="40" align="center" nowrap="nowrap"> <?php if ( $showPlayers_config['show_player_icon'] == 1 ) { // look for picture in Playertool first if ( $row->picture && file_exists( _JOOMLA_JL_PATH.'/'.$row->picture ) ) { $picture = $row->picture; } // otherzise, look for defqult picture on player objet else if ( $row->default_picture && file_exists( _JOOMLA_JL_PATH.'/'.$row->default_picture ) ) { $picture = $row->default_picture; } else { $picture = null; } if ( $picture ) { $Thumb = new PowerThumb(); $Thumb->setSrc( $picture ); $Thumb->setDescription( $row->description ); $Thumb->setAlt( $row->firstname." ".$row->lastname ); $Thumb->setMaxHeight( 30 ); $Thumb->setAmpliationLink( false) ; //$Thumb->setFilter("gray"); $Thumb->create(); } } ?> </td> <td style="width:250;"> <?php if ( $showPlayers_config['link_player'] == 1 ) { ?> <a href="<?php echo sefRelToAbs(JL_COMPONENT_LINK."&func=showPlayer&p=$joomleague->id&pid=$row->pid".JL_ITEMID_SUFFIX);?>"> <?php printf("<i>%s %s</i>",$row->firstname,$row->lastname);?></a> <?php } else { printf("<i>%s %s</i>",$row->firstname,$row->lastname); } ?> </td> <td width="5%" align="left"> <?php if( $row->injury > 0 && $row->injury_end > $joomleague->current_round ) { echo '<img src="'.JL_TEMPLATE_FOLDERS_URL.'images/injured.gif" alt="" />'; } ?> <?php if( $row->suspension > 0 && $row->suspension_end > $joomleague->current_round) { echo '<img src="'.JL_TEMPLATE_FOLDERS_URL.'images/suspension.gif" alt="" />'; } ?> </td> <td style="width:16px;" nowrap="nowrap" align="left"> <?php if ( $row->nation ) { $thiscountry = new Country($database); $thiscountry->load($row->nation); echo $thiscountry->getFlag(); } else { print ' '; } ?> </td> <?php if ( isset($showPlayers_config['show_birthday']) && $showPlayers_config['show_birthday'] == 1) { ?> <td width="10%" nowrap="nowrap" align="left"> <?php printf("%s (%s)", mbiFormatDate($row->birthday,_JL_PLAYERS_BIRTHDATE_DATE), getAge( $row->birthday, $joomleague->start_date )); ?> </td> <?php } if ($showPlayers_config['show_stats']==1) { if ( $overall_config['use_jl_substitution'] ) { $query = "SELECT count(mp.id) as played, sum(mp.came_in) as sub_in, sum(mp.out = 1) AS sub_out FROM #__joomleague_match_players AS mp LEFT join #__joomleague_matches AS m ON mp.match_id = m.match_id WHERE mp.player_id = '".$row->player_id."' AND m.project_id = '".$joomleague->id."'"; $database->setQuery($query); $inoutstat = $database->loadObjectList(); if ($inoutstat[0]->played > 0) { if ( $showPlayers_config['show_games_played'] ) { echo '<td align="center" nowrap="nowrap">'.$inoutstat[0]->played; if ($showPlayers_config['show_substitution_stats'] == 1) { echo ' <acronym title="'._JL_STARTING_ROSTERS.'">(' .(($inoutstat[0]->played - $inoutstat[0]->sub_in > 0) ? $inoutstat[0]->played - $inoutstat[0]->sub_in : '-') .')</acronym>'; } echo '</td>'; } if ( $showPlayers_config['show_substitution_stats'] ) { echo '<td align="center">'.(($inoutstat[0]->sub_in > 0) ? $inoutstat[0]->sub_in : '-').'</td>'; echo '<td align="center">'.(($inoutstat[0]->sub_out > 0) ? $inoutstat[0]->sub_out : '-').'</td>'; } } else { if ( $showPlayers_config['show_games_played'] ) { echo '<td align="center">-</td>'; } if ( $showPlayers_config['show_substitution_stats'] ) { echo '<td align="center">-</td><td align="center">-</td>'; } } } if (isset($PosEventtypes[$row->position_id]) && $overall_config['use_jl_events']) if ( count( $PosEventtypes[$row->position_id] ) ) { foreach ($playerStats[$row->id] AS $eventId => $stat) { echo '<td align="center">'; echo ($stat!=""&&$stat>0)?$stat:"-"; echo '</td>'; } } }?> </tr> <?php $k = 1 - $k; } ?> Dovrei cambiare quell'if... // Display position separator ? if ( $position != $row->position ) { $position = $row->position; $k = 0; che stampa i record ordinati per ruolo... con uno semplice che stampi i record ordinati per numero di maglia.... non sono molto pratico di php... qualcuno può aiutarmi?? Grazie! Link al commento Condividi su altri siti Altre opzioni di condivisione...
pix Inviato 26 Ottobre 2010 Segnala Condividi Inviato 26 Ottobre 2010 dovresti intervenire a monte di tutto ciò, nella query, aggiungendo un "ORDER BY position_number". poi il recorset viene letto riga per riga già ordinato. An a tuesday keeps the doctor away. proud member of < noi finti professionisti > club - tessera 044 Link al commento Condividi su altri siti Altre opzioni di condivisione...
altod Inviato 26 Ottobre 2010 Autore Segnala Condividi Inviato 26 Ottobre 2010 giusto! trovato! era in un'altra pagina dove sono presenti tutti i codici di richiamo dei campi. Grazie mille! Link al commento Condividi su altri siti Altre opzioni di condivisione...
Messaggi raccomandati
Archiviato
Questa discussione è archiviata e chiusa a future risposte.