Inhalte einer DB neben Links ausgeben

R

r.p.

Grünschnabel
Hallo zusammen.

Auf meiner Club-Homepage werden Fotos von Mitgliedern aus einer Datenbank ausgelesen und als weiterführende Links aufgereiht. D.h. 20 Fotos werden als Thumbnails in 4 Zeilen und 5 Spalten angezeigt. Wenn man auf eines dieser Fotos klickt kommt man auf eine Seite wo nähere Informationen über diese Person angegeben werden.

-Das habe ich noch zusammen gebracht. Aber jetzt stehe ich total an:

Ich möchte dass die Informationen (nach klick auf ein Thumbnail) nicht in einer neuen Seite sondern rechts von der Tabelle mit den Thumbs angezeigt werden.

Also ich hätte gerne eine Tabelle mit den 20 Bildern und daneben eine Tabelle mit den Informationen zu der Person die gerade angeklickt wurde.


Ich hoffe das war irgendwie verständlich...? :think:
Vielleicht kennt jemand eine einfache Lösung?
Ich bin für jeden Anhaltspunkt dankbar...

Liebe Grüße, R.P
 
Ohne mir viele Gedanken zu machen, würde ich sagen, da bietet sich eine Lösung mit AJAX an...
Gruss
d22
 
Danke für die schnelle Antwort.

Aber Ajax kenne ich nur als Fensterputzmittel.
Ich habe diesen Code aus einer Komponente für Joomla zusammengestohlen.

Und wie gesagt es funktioniert ja -nur eben nicht gleichzeitig im selben Fenster...

Ich poste hier mal den Code:
Leider gibts online noch nichts anzusehen weil ichs erstmal auf einenm Testserver ausprobieren möchte.

class HTML_contxtd {
function displaylist( &$categories, &$rows, $catid, $currentcat=NULL, &$params, $tabclass ) {
global $Itemid, $mosConfig_live_site, $hide_js;
?>
<form action="index.php" method="post" name="adminForm">
<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">
<tr>
<td>
<?php
if ( count( $rows ) ) {HTML_contxtd::showTable( $params, $rows, $catid, $tabclass );
}
?>
</td>
</tr>
</table>
</form>
<?php
mosHTML::BackButton ( $params, $hide_js );
}
function showTable( &$params, &$rows, $catid, $tabclass ) {
global $mosConfig_live_site, $Itemid;
?>
<table border="0" cellspacing="5" cellpadding="0" align="center"><tr>
<?php
$k = 0;
foreach ($rows as $row)
{
$link = 'index.php?option=com_contxtd&amp;task=view&amp;contact_id='. $row->id .'&amp;Itemid='. $Itemid;
$counter = $counter + 1;
?>
<td width="52" height="72" align="center" valign="middle"><a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>"><img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $row->image; ?>" align="middle" alt="Kontakt" border="1px" title="<?php echo $row->name; ?>, <?php echo $row->con_position; ?>" width="50" height="70" /></a></td>
<?php
if($counter%5 == 0) {
?>
</tr>
<tr>
<?php }
?>
<?php
$k = 1 - $k;
}
?>
<tr>
<td colspan="5">um mehr über ein Mitglied zu erfahren klicke bitte auf eines der Bilder...</td>
</tr>
</table>


<?php
}



function viewcontact( &$contact, &$params, $count, &$list, &$menu_params, $task ) {
global $mosConfig_live_site;
global $mainframe, $Itemid;
$template = $mainframe->getTemplate();
$sitename = $mainframe->getCfg( 'sitename' );
$hide_js = mosGetParam($_REQUEST,'hide_js', 0 );
?>
<script language="JavaScript" type="text/javascript">
<!--
function validate(){
if ( ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
alert( "<?php echo _CONTACT_FORM_NC; ?>" );
} else {
document.emailForm.action = "<?php echo sefRelToAbs("index.php?option=com_contxtd&Itemid=$Itemid"); ?>"
document.emailForm.submit();
}
}
//-->
</script>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table border="0" width="100%">
<tr>
<td>
<?php
HTML_contxtd::_writeContactAddress( $contact, $params );
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
mosHTML::BackButton ( $params, $hide_js );
}
function _writeContactAddress( &$contact, &$params ) {
if ( ( $params->get( 'address_check' ) > 0 ) && ( $contact->address || $contact->suburb || $contact->state || $contact->country || $contact->postcode ) ) {
global $mosConfig_live_site;
?>
<table width="300" cellpadding="0" cellspacing="0" id="teamfenster" >
<tr>
<td colspan="2" height="260" align="center" valign="middle"><img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $contact->image; ?>" align="middle" alt="Contact" /></td>
</tr>
<tr>
<td colspan="2"><div id="teamfensterheading"><?php echo $contact->name; ?></div><hr size="1" color="#000000" /></td>
</tr>
<tr>
<td colspan="2"><?php echo $contact->con_position; ?><br /><br /></td>
</tr>
<tr>
<td align="left">Geburtsdatum:</td>
<td> <?php echo $contact->company; ?></td>
</tr>
<tr>
<td valign="top" width="100" align="left">Adresse:</td>
<td valign="top" align="left"><?php echo $contact->address;?>,<br /><?php echo $contact->postcode;?> <?php echo $contact->suburb;?></td>
</tr>
<tr>
<td align="left">E-Mail:</td>
<td> <?php echo $contact->email;?></td>
</tr>
<tr>
<td align="left">Telefon:</td>
<td><?php echo $contact->telephone1; ?></td>
</tr>
<tr>
<td colspan="2"><br /><?php echo $contact->misc1; ?></td>
</tr>
</table>




<?php
}
}
function nocontact( &$params ) {
mosHTML::BackButton ( $params );
}
}
?>
 
Hallo.

Danke, aber wenn ich einen I-Frame verwende wird darin die ganze Seite nochmal angezeigt (d.h. mit Menü und Hintergrund usw...)

...da muss es eine saubere PHP-Lösung geben... ?(
 
Pack die Zusatztabelle mit allen Infos in eine Div, mache bei jeder Person einen anchor mit namen und verlinke die bilder dann mit dem anchor.
BSP:
Code:
<a href="#person1"><img src="bild1.gif" alt="bild1"></a>
<a href="#person2"><img src="bild2.gif" alt="bild2"></a>

<div class="info" style="width:25%;height:512px;overflow:hidden;border:1px solid black;float:right;">

<div class="personinfo1" style="margin:1000px 0px;">
<a name="person1"></a>
Name: Hans Wurst<br>
Gewicht: 100Kg
</div>

<div class="personinfo2" style="margin:1000px 0px;">
<a name="person2"></a>
Name: Homo Faber<br>
Gewicht: 70Kg
</div>

</div>
Glaube das #anchor-Ansprechen in ner Div klappt mit Opera nicht aber sonst is das ne coole js-alternative!
 
Ohh Jahh!
- Genau das wollte ich wissen.
Danke vielmals!
Ich hab noch ein bisschen modifiziert und jetzt funktionierts...

Sollte sich noch jemand (außer mir) dafür interessieren -hier ist der Code:

<table width="650" border="0">
<tr>
<td width="320" align="left" valign="top">



<table width="280" border="0" cellspacing="5" cellpadding="0" align="center"><tr>
<?php
$k = 0;
foreach ($rows as $row)
{
$link = 'index.php?option=com_contxtd&amp;task=view&amp;contact_id='. $row->id .'&amp;Itemid='. $Itemid;
$counter = $counter + 1;
?>
<td width="52" height="72" align="center" valign="middle"><a href="#<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>"><img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $row->image; ?>" align="middle" alt="Kontakt" border="1px" title="<?php echo $row->name; ?>, <?php echo $row->con_position; ?>" width="50" height="70" /></a></td>
<?php
if($counter%5 == 0) {
?>
</tr>
<tr>
<?php }
?>
<?php
$k = 1 - $k;
}
?>
<tr>
<td colspan="5">um mehr über ein Mitglied zu erfahren klicke bitte auf eines der Bilder...</td>
</tr>
</table>
</td>
<td align="left" valign="top">
<div class="info" style="width:308px;height:500px;overflow:hidden;border:0px solid gray;float:right;">
<table border="0">
<tr valign="top">
<?php
$k = 0;
foreach ($rows as $row)
{
$link = 'index.php?option=com_contxtd&amp;task=view&amp;contact_id='. $row->id .'&amp;Itemid='. $Itemid;
$name = $row->name;
$image = $row->image;
$position = $row->con_position;
$gebdat = $row->company;
$adress = $row->address.'<br />'.$row->postcode.' '.$row->suburb;
$mail = '<a href="mailto:'. $row->email_to .'">'. $row->email_to .'</a>';
$tel = $row->telephone1;
$info = $row->misc1;
$counter = $counter + 1;
?>


<td colspan="2" align="center" valign="middle"><a name="<?php echo sefRelToAbs( $link ); ?>"></a>
<table width="300" cellpadding="0" cellspacing="0" id="teamfenster" >
<tr>
<td colspan="2" height="260" align="center" valign="middle"><img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $image; ?>" align="middle" alt="Contact" /></td>
</tr>
<tr>
<td colspan="2"><div id="teamfensterheading"><?php echo $name; ?></div><hr size="1" color="#000000" /></td>
</tr>
<tr>
<td colspan="2"><?php echo $position; ?><br /><br /></td>
</tr>
<tr>
<td align="left">Geburtsdatum:</td>
<td> <?php echo $gebdat; ?></td>
</tr>
<tr>
<td valign="top" width="100" align="left">Adresse:</td>
<td valign="top" align="left"><?php echo $adress; ?></td>
</tr>
<tr>
<td align="left">E-Mail:</td>
<td> <?php echo $mail;?></td>
</tr>
<tr>
<td align="left">Telefon:</td>
<td><?php echo $tel; ?></td>
</tr>
<tr>
<td colspan="2"><br /><?php echo $info; ?></td>
</tr>
</table><br /><br /><br /><br /><br /><br /><br /><br /><br />
</td>


</tr>
<?php
$k = 1 - $k;
}
?>
</table>




</div>
</td>
</tr>
</table>

-Ist vielleicht (bzw. sicher...) nicht perfekt, aber es funktioniert.
Liebe Grüße...
 
Zurück
Oben