| | | | |
| |||||||
| PHP-Fortgeschrittene Arbeiten mit PHP ohne Einschränkungen |
|
| | LinkBack | Themen-Optionen | Thema bewerten |
| | |
| Gast
Beiträge: n/a
| hi und hallo. nach x stunden noch keine lösung gefunden. ich frage einfach mal hier nach und hoffe das mir da jemand helfen kann. ding ist.... : eine index seite wo seiten teaser angezeigt werden. für jeder dieser seiten können 1-4 reviews geschrieben werden. diese reviews haben jeweils eine bewertung. auf der index soll für jede seite eine durschnitts bewertung angezeigt werden. hier mal der index.php code Code: <?
require 'inc/functions.inc.php';
require 'libs/Smarty.class.php';
$smarty = new Smarty;
$connect = OpenDB();
$category = $_REQUEST["category"];
//menupunkte selecten
$query = " SELECT *
FROM
kategorie";
$result=mysql_query($query);
while($menu = mysql_fetch_array($result)){
$menue[] = $menu;
}
$smarty->assign("menue", $menue);
//indexteaser selecten
$query = " SELECT *
FROM
category_verwaltung as cv,
kategorie as k,
pages as p
WHERE
cv.cat_id = k.id
AND
cv.page_id = p.id
AND
k.category = '$category'";
$result=mysql_query($query);
while($daten = mysql_fetch_array($result)){
$teaser[] = $daten;
$smarty->assign("teaser", $teaser);
$id = $daten['id'];
echo $id;
$query_sum = " SELECT sum(review_score) / COUNT(review_score) AS gscore
FROM
reviews
WHERE
page_id = '$id'";
$result2 = mysql_query($query_sum);
$score=mysql_fetch_array($result2);
$scores = $score['gscore'];
$smarty->assign("scores", $scores);
echo $scores."
\n";
}
$smarty->fetch("index_teaser.tpl");
$smarty->assign("icons", $icons);
$smarty->assign("path", $img_url);
$smarty->display("index.tpl");
?>
index_teaser.tpl Code: <TABLE width="99%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#000000" class=red>
<TBODY>
<TR>
<TD colspan="2">Kagetgorie :{$category} </TD>
</TR>
</TBODY>
</TABLE>
{foreach from=$teaser item="data"}
<TABLE width="99%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#000000" class=red>
<TBODY>
<TR>
<TD>Name : <span class="headline">{$data.pagename} </span></TD>
<TD colspan="2" valign="top" class=menu></TD>
</TR>
<TR>
<TD width="160">[img]{$path}{$data.pagescreen}[/img]</TD>
<TD colspan="2" valign="top" class=menu><div align="justify" class="text">{$data.page_teaser}</div>
</TD>
</TR>
<TR>
<TD width="160" bgcolor="#CCCCCC" class="in3 Stil1"><div align="center"><font color="#FFFFFF">{$scores}</font></div></TD>
<TD width="936" valign="top" bgcolor="#CCCCCC"><a href="anzeigen.php?category={$data.category}&article={$data.pagename}">Review
zu {$data.pagename}lesen</a></TD>
<TD width="142" valign="top" bgcolor="#CCCCCC"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{$data.Datum}</font></div></TD>
</TR>
</TBODY>
</TABLE>
{/foreach}
seiten id 1 = durchschnitts bewertung zu 1, seiten id 2 = durchschnitts bewertung zu 2 bei der smarty ausgabe wird nur der zuletzt ermittelte durschnittswert angezeigt. also seiten id 1 = durchschnitts bewertung zu 2, seiten id 2 = durchschnitts bewertung zu 2 woran kanns liegen? wer kann mir da weiterhelfen? vielen dank im voraus Grüße Pixorzist |
|
| | |
| PHP Code Flüsterer Registriert seit: 21.08.2005 Beiträge: 4682 PHP-Kenntnisse: Fortgeschritten | |
|
| Themen-Optionen | |
| Thema bewerten | |
|
|
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Smarty + MySQL = immer falsche Ausgabe | m0use` | PHP Tipps 2006 | 44 | 21.11.2008 20:30 |
| Was ist Aufgabe des Templates (Smarty), was nicht? | agrajag | PHP Tipps 2007 | 8 | 24.02.2007 13:19 |
| Smarty => 1ste allgemeine Verunsicherung | Canni | PHP Tipps 2006 | 7 | 10.10.2006 17:56 |
| Smarty + Oop Problem | Komandar | PHP Tipps 2006 | 5 | 25.07.2006 14:36 |
| problem mit javascript und smarty | snatch-ic | HTML, Usability und Barrierefreiheit | 2 | 08.06.2006 22:11 |
| Smarty verschachtelt | snatch-ic | PHP Tipps 2006 | 16 | 28.02.2006 20:54 |
| [Erledigt] Navigation auf Smarty umstellen?! | PHP-Fortgeschrittene | 3 | 10.01.2006 09:19 | |
| while schleife in einer while schleife beim tmpl-sys | PHP Tipps 2005-2 | 0 | 27.07.2005 15:07 | |
| Frage zu Smarty | PHP Tipps 2005-2 | 10 | 07.07.2005 14:49 | |
| Smarty Error | Simon9990 | PHP Tipps 2005-2 | 8 | 07.07.2005 09:34 |
| 2 verschachtelte while Schleifen. Großes Performanceproblem | Datenbanken | 3 | 30.05.2005 12:52 | |
| Smarty und X-Cart Profis gesucht | Beitragsarchiv | 1 | 21.05.2005 13:38 | |
| [Erledigt] includepathproblem pear blockiert smarty und umgekehrt | PHP Tipps 2005 | 1 | 08.05.2005 18:46 | |
| Mit While selektieren und Daten rausholen (HILFE)!! | Spike_php | Datenbanken | 7 | 12.12.2004 20:08 |
| Smarty Templates + Radio Buttons + Auswertung | Transmitter | PHP-Fortgeschrittene | 0 | 05.07.2004 18:29 |
| Besucher kamen über folgende Suchanfragen bei Google auf diese Seite |
| smarty while, smarty menu, while smarty, smarty & &, php form select option mysql \while in while\, while php, smarty while schleifen, smarty menue, smarty while php, ampps smarty, smarty 3 {php} while, smarty menu data, php smarty menu, amp smarty, smarty {while}, smarty \while in while\, smarty while schleife, http://www.php.de/php-fortgeschrittene/27614-erledigt-php-smarty-while-problematik.html, php >, php > |

Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.