Przedszkolak
Postów: 14
Data rejestracji: 02.07.2007 22:46
|
Dziękuję za pomoc ale jakoś nic nie działa, pewnie moja wina, podaje pełną treść pliku wyświetlającego całą stronę recenzji:
<?php
/*--------------------------------------------+
| PHP-Fusion 5 - Content Management System |
|---------------------------------------------|
| author: Nick Jones (Digitanium) ę 2002-2005 |
| web: http://www.php-fusion.co.uk |
| email: |
|---------------------------------------------|
| Released under the terms and conditions of |
| the GNU General Public License (Version 2) |
+--------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once INCLUDES."sendmail_include.php";
// panele
require_once "side_left.php";
include LOCALE.LOCALESET."artists.php";
$id = isNum($_GET['id']) ? $_GET['id'] : 0;
opentable("<a href='artists.php'>".$locale['cm10']."</a>");
$miesiace = array(' ', 'Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'PaĽdziernik', 'Listopad', 'Grudzień');
if (isset($step) == "") $step = "list";
if ($step == "list") {
if (!isset($sortby)) $sortby = "all";
$search = array(
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R",
"S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"
);
if (!isset($type)) $type = "artist";
echo "<hr><br><br><table align='center' cellpadding='0' cellspacing='1' class='tbl-border'>\n<tr>\n";
echo "<td rowspan='2' class='tbl2'><a href='".FUSION_SELF."?step=list&sortby=all'>".$locale['cm11']."</a></td>";
for ($i=0;$i < 36;$i++) {
echo "<td align='center' class='tbl1'><div class='small'><a href='".FUSION_SELF."?step=list&category=$category&sortby=".$search[$i]."&type=$type'>".$search[$i]."</a></div></td>";
echo ($i==17 ? "<td rowspan='2' class='tbl2'><a href='".FUSION_SELF."?step=list&sortby=all&type=$type'>".$locale['cm11']."</a></td>\n</tr>\n<tr>\n" : "\n");
}
echo "</tr>\n</table><br><br>\n";
if ($type == "artist") {
$orderby = ($sortby == "all" ? "" : "WHERE a.artist_name LIKE '".stripinput($sortby)."%'");
$result = dbquery("SELECT * FROM ".$db_prefix."artist a ".$orderby." ORDER BY artist_name");
$rows = dbrows($result);
if ($rows != 0) {
$i = 0;
echo "<table align='center' cellpadding='0' cellspacing='0' width='450' class='border'>
<tr>
<td class='tbl2'><b>".$locale['cm22']."</b></td>
</tr>\n";
while ($data = dbarray($result)) {
$klasa = ($i % 2 == 0 ? "tbl1" : "tbl2");
echo "<tr>
<td class='".$klasa."'>
<a href='".FUSION_SELF."?step=review&artist_id=".$data['artist_id']."'><b>".$data['artist_name']."</b></a>
</td>
</tr>";
$i++;
}
echo "</table><br><br>";
} else {
echo "<center><br>\n".$locale['cm12']."$sortby<br><br>\n</center>\n";
}
} else if ($type == "review") {
$orderby = ($sortby == "all" ? "" : " WHERE review_name LIKE '".stripinput($sortby)."%'");
$result = dbquery("SELECT * FROM ".$db_prefix."review ".$orderby." ORDER BY review_datestamp DESC");
$rows = dbrows($result);
if ($rows != 0) {
$i = 0;
echo "<table align='center' cellpadding='0' cellspacing='0' width='450' class='border'>
<tr>
<td colspan='3' class='tbl2'><b>[ Recenzje ]</b></td>
</tr>
<tr>
<td class='tbl2'></td>
<td class='tbl2'>Recenzja:</td>
</tr>";
while ($data = dbarray($result)) {
$result2 = dbquery("SELECT * FROM ".$db_prefix."artist WHERE artist_id ='".$data['review_artist_id']."'");
$data2 = dbarray($result2);
if (date('d', $data['review_datestamp']) != $dzien) {
$dzien = date('d', $data['review_datestamp']);
$miesiac = intval(date('m', $data['review_datestamp']));
$rok = date('Y', $data['review_datestamp']);
echo "<td colspan='3' style='border-top:2px solid black; border-bottom:2px solid black; background-color: #728000;'> <b>".$dzien."</b> ".$miesiace[$miesiac]." <b>".$rok."</b></td>";
}
$klasa = ($i % 2 == 0 ? "tbl1" : "tbl2");
echo "<tr><td class='".$klasa."'>".($data['review_image'] ? "<a href='".IMAGES."review_images/".$data['review_image']."' target='_blank'><img src='".IMAGES."review_images/t".$data['review_image']."' class='photo'></a>" : "<img src='".IMAGES."brak_obrazka.gif' class='photo'>")."</td>
<td class='".$klasa."'><b>".$data2['artist_name']."<br><a href='".BASEDIR."artists.php?step=review&id=".$data['review_id']."&artist_id=".$data2['artist_id']."'>".substr($data['review_album'], 0 , 30)."</b></a></td>
</tr>";
$i++;
}
echo "</table><br><br>";
} else
echo "<center><br>Nie ma żadnych recenzji, których nazwa zaczyna się na $sortby<br><br>\n</center>\n";
}
} else {
echo "<table width='100%'><tr><td>";
$result2 = dbquery("SELECT * FROM ".$db_prefix."artist WHERE artist_id='$artist_id'");
if (dbrows($result2)) $data2= dbarray($result2);
echo "<br><b>".strtoupper($data2['artist_name'])." </b><hr></td></tr><tr><td width='100%' valign='top'>
<table width='100%'><tr><td colspan='2'></td></tr>";
$result = dbquery("SELECT * FROM ".$db_prefix."review a, ".$db_prefix."artist b WHERE a.".$step."_artist_id = b.artist_id AND a.review_artist_id='$artist_id' AND a.review_id='$id'");
if ($id) {
$data = dbarray($result);
$numer = $id;
echo "<tr><td><table><tr><td width='152px' class='photo_border'>".($data['review_image'] ? "<a href='".IMAGES."review_images/".$data['review_image']."' target='_blank'><img src='".IMAGES."review_images/t".$data['review_image']."' class='photo'></a>" : "<img src='".IMAGES."brak_obrazka.gif' class='photo'>")."<td width='100%'></td></tr></table></td></tr>
<tr><td>
<table>
<tr><td style='text-align=right;'>".$locale['cm24']."</td><td>".$data['review_album']."</td></tr>
<tr><td style='text-align=right;'>".$locale['cm24']."</td><td>".$data['review_name']"</td></tr>
<tr><td style='text-align=right;'>".$locale['cm25']."</td><td>
$result = dbquery(
SELECT tn.*, review_name FROM ".$db_prefix."review tn
LEFT JOIN ".$db_prefix."users tu ON tn.review_name=tu.user_id);</td></tr>
<tr><td style='text-align=right;'>".$locale['cm25']."</td><td>".$data['review_year']."</td></tr>
<tr><td style='text-align=right;'>".$locale['cm26']."</td><td><a href='".$data['review_url']."'>".$data['review_url_title']."</a></td></tr>
<tr><td style='text-align=right;'>".$locale['cm27']."</td><td>".str_repeat('<img src="'.IMAGES.'star.gif" alt="">', $data['review_note'])."</td></tr>
<tr><td valign='top' style='text-align=right;'>".$locale['cm28']."</td><td style='text-align : justify;'>".$data['review_body']."</td></tr>
</table>
</td></tr>";
} else {
$result = dbquery("SELECT * FROM ".$db_prefix."review a, ".$db_prefix."artist b WHERE a.review_artist_id = b.artist_id AND a.review_artist_id='$artist_id'");
if (dbrows($result)) {
while ($data = dbarray($result)) {
echo "<tr><td width='52px' class='photo_border'>".($data['review_image'] ? "<a href='".IMAGES."review_images/".$data['review_image']."' target='_blank'><img src='".IMAGES."review_images/t".$data['review_image']."' class='photo_border' width='50'></a>" : "<img src='".IMAGES."tbrak_obrazka.gif' class='photo_border'>")."</td>
<td><a href='".FUSION_SELF."?step=review&id=".$data['review_id']."&artist_id=".$data['artist_id']."'> ".$data['review_album']."</td>
</tr><tr><td colspan='2'><hr></td></tr>";
}
} else {
$komunikat = $locale['cm20'];
}
}
echo "</table></td></tr></table>\n";
}
closetable();
include INCLUDES."comments_include.php";
showcomments('r','review',"review_id",$id,FUSION_SELF."?step=review&type=comments&artist_id=".$artist_id."&id=".$id);
require_once "side_right.php";
require_once "footer.php";
?>
Ja edytowałem jedynie linię:
<tr><td style='text-align=right;'>".$locale['cm24']."</td><td>".$data['review_name']"</td></tr>
próbując wstawić poprawny kod wyświetlający autora recenzji.
Co do bazy danych to w bazie _rewiev zapisywane są min.: review_name -> autor recenzji rozpoznawany po ID użytkownika, review_artist_id -> to nazwa zespołu, dodawana po numerze ID, review_body - treść recenzji.
Oki, walczę z tym problemem samodzielnie mam już połowiczy sukces, dodałem kod:
<a href='".BASEDIR."profile.php?lookup=".$data['review_name']."'".$link_class.">".$data['review_name']."</a>
Pojawia się link do danego usera, jednak zamiast wyświetlenia jego nazwy (czyli pobranie danych z bazy ep_users z tabeli user_name) wyświetla się jedynie numer, czyli zawartość bazy review_name. Jak zrobić, aby wyświetlała się nazwa użytkownika, zamiast jego numeru id? W tabeli review_name wprowadzany jest jedynie parametr id usera jednak w tej tabeli nie mam nazwy użytkownika, trzeba to jakoś powiązać czyli wprowadzić parametr że review_name = user_id, ale nie wiem jak to zrobić.
Edytowane przez mike dnia 12.01.2008 22:16:31
|