我有一个包含大约20个SQL查询的主页:
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.date_last_edited, i.image_model_type, i.image_class, i.image_motor_type".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id = 71
ORDER BY i.date_last_edited DESC
LIMIT 25";
// end new
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$random_images = "<div><div><div>";
// $random_images .= $lang['no_new_images'];
$random_images .= "</div></div></div>";
}
else {
$random_images = "<div>";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$random_images .= "<div>\n";
}
$random_images .= "<div>\n";
show_image($image_row);
$random_images .= $site_template->parse_template("home_contents_latest_table");
$random_images .= "\n</div>\n";
$count++;
if ($count == 1) {
$random_images .= "</div>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = (1 - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$random_images .= "<div>\n \n</div>\n";
}
$random_images .= "</div>\n";
}
}
$random_images .= "</div>\n";
} // end else
$site_template->register_vars("home_contents_latest_table", $random_images);
unset($random_images);
在主页的布局中,它们在引导选项卡中分组,因此在页面加载时只能看到4个。
我的问题是。是否可以仅在用户单击选项卡以查看其内容时调用非活动选项卡上的查询?
我知道这是一个非常普遍的问题,但我很乐意回答一下,你必须使用这种或那种语言来做这个或那个。然后我会自己调查......
非常感谢您的任何提示。
佛瑞德