4images Forum & Community
General / Allgemeines => Programming => Topic started by: Sunny C. on October 25, 2009, 02:38:33 PM
-
Was muss ich denn machen wenn ich 3 SQl Abfragen habe?
$sql = "SELECT setting_value as news_ticker FROM ".SETTINGS_TABLE." WHERE setting_name = 'news_ticker'";
$result = $site_db->query($sql);$row = mysql_fetch_object($result);
$news_ticker = $row->news_ticker;
$headline = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$headline .= "<tr class=\"imagerow2\">\n";
$headline .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$news_ticker."</marquee></td>\n";
$headline .= "</tr>\n";
$headline .= "</table>\n";
$sql = "SELECT setting_value as index_welcome FROM ".SETTINGS_TABLE." WHERE setting_name = 'index_welcome'";
$result = $site_db->query($sql);$row = mysql_fetch_object($result);
$index_welcome = $row->index_welcome;
$headline = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$headline .= "<tr class=\"imagerow2\">\n";
$headline .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$index_welcome."</marquee></td>\n";
$headline .= "</tr>\n";
$headline .= "</table>\n";
$sql = "SELECT setting_value as left_info FROM ".SETTINGS_TABLE." WHERE setting_name = 'left_info'";
$result = $site_db->query($sql);$row = mysql_fetch_object($result);
$left_info = $row->left_info;
$headline = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$headline .= "<tr class=\"imagerow2\">\n";
$headline .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$left_info."</marquee></td>\n";
$headline .= "</tr>\n";
$headline .= "</table>\n";
Wenn die direkt untereinander stehen, dann wird NUR eins angezeigt, entwerder "news_ticker", "index_welcome" oder "left_info". Aber es werden nie alle drei ausgegeben.
Muss zwischen den SQL Abfragen noch etwas dazwischen wie z.B
}
oderso?
-
Hi!
die SQL abfragen kann man sich eigentlich ersparen.
$news_ticker = $config['news_ticker'];
$index_welcome = $config['index_welcome'];
$left_info = $config['left_info'];
$headline = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$headline .= "<tr class=\"imagerow2\">\n";
$headline .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$news_ticker."</marquee></td>\n";
$headline .= "</tr>\n";
$headline .= "</table>\n";
$headline .= "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$headline .= "<tr class=\"imagerow2\">\n";
$headline .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$index_welcome."</marquee></td>\n";
$headline .= "</tr>\n";
$headline .= "</table>\n";
$headline .= "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$headline .= "<tr class=\"imagerow2\">\n";
$headline .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$left_info."</marquee></td>\n";
$headline .= "</tr>\n";
$headline .= "</table>\n";
mfg Andi
-
Und ich kann trotzdem dann
{news_ticker}
{index_welcome}
{left_info}
verwenden?
Also ich möchte z.B
{news_ticker}
oben auf der Seite anzeigen
{index_welcome}
z.B in der Mitte
und
{left_info}
in der linken Seite
Muss ich nicht das noch verwenden?
"news_ticker" => $headline,
"lang_news_ticker" => $lang['news_ticker'],
"index_welcome" => $headline,
"lang_index_welcome" => $lang['index_welcome'],
"left_info" => $headline,
"lang_left_info" => $lang['left_info'],
Muss ich das nicht also so quasi abändern?
"news_ticker" => $headline1,
"lang_news_ticker" => $lang['news_ticker'],
"index_welcome" => $headline2,
"lang_index_welcome" => $lang['index_welcome'],
"left_info" => $headline3,
"lang_left_info" => $lang['left_info'],
Du musst dir vorstellen, ich habe dein news_ticker Mod drei mal eingebaut, jeweils nur mit anderen Namen "news_ticker" "index_welcome" und "left_info" verwende die anderen beiden nur anderweitig
Edit://
Also ich weis da wirklich nicht weiter! Stimmt meine Variante?
-
$news_ticker = $config['news_ticker'];
$index_welcome = $config['index_welcome'];
$left_info = $config['left_info'];
$ticker = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$ticker .= "<tr class=\"imagerow2\">\n";
$ticker .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$news_ticker."</marquee></td>\n";
$ticker .= "</tr>\n";
$ticker .= "</table>\n";
$welcome = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$welcome .= "<tr class=\"imagerow2\">\n";
$welcome .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$index_welcome."</marquee></td>\n";
$welcome .= "</tr>\n";
$welcome .= "</table>\n";
$info = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$info .= "<tr class=\"imagerow2\">\n";
$info .= "<td ><marquee behavior='alternate' scrollamount='3' scrolldelay='1'>".$left_info."</marquee></td>\n";
$info .= "</tr>\n";
$info .= "</table>\n";
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream,
"news_ticker" => $ticker,
"lang_news_ticker" => $lang['news_ticker'],
"index_welcome" => $welcome,
"lang_index_welcome" => $lang['index_welcome'],
"left_info" => $info,
"lang_left_info" => $lang['left_info'],
));
mfg Andi