4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: OtusDesign on July 12, 2008, 10:50:21 AM
-
Hi,
I used mini-top in past but now Im using edited top.php. When I used mini-top, after add {mini_top_images} code on home.html, it works.
My question is ; is it possible to use my top.php file on home.html ? I used iframe, when clicked on a picture,username exc., it will open in iframe so I dont want to use iframe on my home.html
Finally is it possible to use my top.php or toplist system on home.html ?
Thanks is advance and sorry for my bad english
-
Hello Otus,
you asked an important question. I want to know it too. I use v1.7.7
How is it possible that i can show the "Top images" on home.php?
And i tried Mini-Top too and it works - but i think thats not the optimal way.
So i kicked Mini-Top and now i tried following
I want a style like "top.html". This list i want to right from "New images".
So i tried following:
<div id="home-zusammenfassung">
<div id="home-left">
TABLE BLA BLA
{lang_new_images}
TABLE BLA BLA
{new_images}
TABLE BLA BLA
</div><!-- div id home-left ENDE -->
<div id="home-right">
HERE I WANT TO GET THE TOP IMAGES
</div><!-- div id home-right ENDE -->
</div><!-- div id home-zusammenfassung ENDE -->
Of course I modified the CSS for the id's in an external File.
The Layout is ok.
Now i thought: hey, copy only the selected table from "top.html" into my created id="home-right" on "home.php".
For example i choose the code (direct copyd / not modified) for Showing images by rating. I only cutted the code for showing images by voting or downloading or something else.
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="bordercolor">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="head1" valign="top" colspan="5">{lang_top_image_rating}</td>
</tr>
<tr>
<td valign="top" class="row1" align="center"><b>1</b></td>
<td valign="top" class="row1">{image_rating_1}</td>
<td valign="top" class="row1">{image_rating_user_1}</td>
<td valign="top" class="row1">{image_rating_cat_1}</td>
<td valign="top" class="row1" nowrap>{image_rating_number_1}</td>
</tr>
<tr>
<td valign="top" class="row2" align="center"><b>2</b></td>
<td valign="top" class="row2">{image_rating_2}</td>
<td valign="top" class="row2">{image_rating_user_2}</td>
<td valign="top" class="row2">{image_rating_cat_2}</td>
<td valign="top" class="row2" nowrap>{image_rating_number_2}</td>
</tr>
<tr>
<td valign="top" class="row1" align="center"><b>3</b></td>
<td valign="top" class="row1">{image_rating_3}</td>
<td valign="top" class="row1">{image_rating_user_3}</td>
<td valign="top" class="row1">{image_rating_cat_3}</td>
<td valign="top" class="row1" nowrap>{image_rating_number_3}</td>
</tr>
<tr>
<td valign="top" class="row2" align="center"><b>4</b></td>
<td valign="top" class="row2">{image_rating_4}</td>
<td valign="top" class="row2">{image_rating_user_4}</td>
<td valign="top" class="row2">{image_rating_cat_4}</td>
<td valign="top" class="row2" nowrap>{image_rating_number_4}</td>
</tr>
<tr>
<td valign="top" class="row1" align="center"><b>5</b></td>
<td valign="top" class="row1">{image_rating_5}</td>
<td valign="top" class="row1">{image_rating_user_5}</td>
<td valign="top" class="row1">{image_rating_cat_5}</td>
<td valign="top" class="row1" nowrap>{image_rating_number_5}</td>
</tr>
<tr>
<td valign="top" class="row2" align="center"><b>6</b></td>
<td valign="top" class="row2">{image_rating_6}</td>
<td valign="top" class="row2">{image_rating_user_6}</td>
<td valign="top" class="row2">{image_rating_cat_6}</td>
<td valign="top" class="row2" nowrap>{image_rating_number_6}</td>
</tr>
<tr>
<td valign="top" class="row1" align="center"><b>7</b></td>
<td valign="top" class="row1">{image_rating_7}</td>
<td valign="top" class="row1">{image_rating_user_7}</td>
<td valign="top" class="row1">{image_rating_cat_7}</td>
<td valign="top" class="row1" nowrap>{image_rating_number_7}</td>
</tr>
<tr>
<td valign="top" class="row2" align="center"><b>8</b></td>
<td valign="top" class="row2">{image_rating_8}</td>
<td valign="top" class="row2">{image_rating_user_8}</td>
<td valign="top" class="row2">{image_rating_cat_8}</td>
<td valign="top" class="row2" nowrap>{image_rating_number_8}</td>
</tr>
<tr>
<td valign="top" class="row1" align="center"><b>9</b></td>
<td valign="top" class="row1">{image_rating_9}</td>
<td valign="top" class="row1">{image_rating_user_9}</td>
<td valign="top" class="row1">{image_rating_cat_9}</td>
<td valign="top" class="row1" nowrap>{image_rating_number_9}</td>
</tr>
<tr>
<td valign="top" class="row2" align="center"><b>10</b></td>
<td valign="top" class="row2">{image_rating_10}</td>
<td valign="top" class="row2">{image_rating_user_10}</td>
<td valign="top" class="row2">{image_rating_cat_10}</td>
<td valign="top" class="row2" nowrap>{image_rating_number_10}</td>
</tr>
</table>
</td>
</tr>
</table>
I upload the modified "home.php", reload the site and there is only ... i dont know how to say, but enough. I looked at the Sourcecode and it shows me:
CODE AND BLA BLA
<tr>
<td valign="top" class="row1" align="center"><b>1</b></td>
<td valign="top" class="row1"></td>
<td valign="top" class="row1"></td>
<td valign="top" class="row1"></td>
<td valign="top" class="row1" nowrap></td>
</tr>
<tr>
<td valign="top" class="row2" align="center"><b>2</b></td>
<td valign="top" class="row2"></td>
<td valign="top" class="row2"></td>
<td valign="top" class="row2"></td>
<td valign="top" class="row2" nowrap></td>
</tr>
CODE AND BLA BLA
Do u see? Ther is no content in the td's. It looks like that the variables dosn't load.
Where is the failure? Do i have to change the "functions.php" too? Yes? - Where?
I really dont know why there is not the wished content.
I tried to explain the situation well. If any information important i will post it.
Thank everybody for help.
Paul
-
... du musst den entsprechenden Teil aus der top.php, in dem die von dir verwendeten Tags ( {image_rating_1} ... u.s.w) definiert und registriert werden, in deine index.php kopieren ...
... nur dann kannst du die Tags auch in der home.html in der von dir gewählten Tabelle verwenden ...
-
Hallo Ozus, hallo Gemeinschaft,
danke. Nach kurzem Aufwand habe ich es zum laufen bekommen. Super. Folgenden Code habe ich direkt aus der index.php kopiert:
//-----------------------------------------------------
//--- Show Top Images ---------------------------------
//-----------------------------------------------------
$cat_match_sql = ($cat_id && check_permission("auth_viewcat", $cat_id)) ? "AND i.cat_id = '$cat_id' " : "";
$register_array = array();
$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
// Rating
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
$cat_match_sql
ORDER BY i.image_rating DESC, i.image_name ASC
LIMIT 10";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
$top_list[$i] = $row;
$i++;
}
$site_db->free_result();
for ($i = 1; $i <= 10; $i++) {
if (isset($top_list[$i])) {
$register_array['image_rating_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'], 2)."</a>" : format_text($top_list[$i]['image_name'], 2);
$register_array['image_rating_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$top_list[$i]['user_id'];
$register_array['image_rating_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
}
else {
$register_array['image_rating_user_'.$i] = $lang['userlevel_guest'];
}
$register_array['image_rating_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
$register_array['image_rating_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
}
else {
$register_array['image_rating_'.$i] = "--";
$register_array['image_rating_user_'.$i] = "--";
$register_array['image_rating_cat_'.$i] = "--";
$register_array['image_rating_number_'.$i] = "--";
}
}
// Votes
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
$cat_match_sql
ORDER BY i.image_votes DESC, i.image_name ASC
LIMIT 10";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
$top_list[$i] = $row;
$i++;
}
$site_db->free_result();
for ($i = 1; $i <= 10; $i++) {
if (isset($top_list[$i])) {
$register_array['image_votes_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
$register_array['image_votes_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$top_list[$i]['user_id'];
$register_array['image_votes_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
}
else {
$register_array['image_votes_user_'.$i] = $lang['userlevel_guest'];
}
$register_array['image_votes_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
$register_array['image_votes_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
}
else {
$register_array['image_votes_'.$i] = "--";
$register_array['image_votes_user_'.$i] = "--";
$register_array['image_votes_cat_'.$i] = "--";
$register_array['image_votes_number_'.$i] = "--";
}
}
// Hits
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
$cat_match_sql
ORDER BY i.image_hits DESC, i.image_name ASC
LIMIT 10";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
$top_list[$i] = $row;
$i++;
}
$site_db->free_result();
for ($i = 1; $i <= 10; $i++) {
if (isset($top_list[$i])) {
$register_array['image_hits_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
$register_array['image_hits_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$top_list[$i]['user_id'];
$register_array['image_hits_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
}
else {
$register_array['image_hits_user_'.$i] = $lang['userlevel_guest'];
}
$register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
$register_array['image_hits_number_'.$i] = "<b>".$top_list[$i]['image_hits']."</b>";
}
else {
$register_array['image_hits_'.$i] = "--";
$register_array['image_hits_user_'.$i] = "--";
$register_array['image_hits_cat_'.$i] = "--";
$register_array['image_hits_number_'.$i] = "--";
}
}
// Downloads
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_downloads, 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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
$cat_match_sql
ORDER BY i.image_downloads DESC, i.image_name ASC
LIMIT 10";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
$top_list[$i] = $row;
$i++;
}
$site_db->free_result();
for ($i = 1; $i <= 10; $i++) {
if (isset($top_list[$i])) {
$register_array['image_downloads_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
$register_array['image_downloads_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" : format_text($top_list[$i]['image_name']);
if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$top_list[$i]['user_id'];
$register_array['image_downloads_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
}
else {
$register_array['image_downloads_user_'.$i] = $lang['userlevel_guest'];
}
$register_array['image_downloads_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
$register_array['image_downloads_number_'.$i] = "<b>".$top_list[$i]['image_downloads']."</b>";
}
else {
$register_array['image_downloads_'.$i] = "--";
$register_array['image_downloads_user_'.$i] = "--";
$register_array['image_downloads_cat_'.$i] = "--";
$register_array['image_downloads_number_'.$i] = "--";
}
}
$site_template->register_vars($register_array);
Oder sollte ich daran noch etwas ändern. Das "$site_template->register_vars($register_array);" kommt mir komisch vor. Sonnst alles ok mit dem Code? Hätte jemand Einwände / Vorschläge?
Ich bedanke mich vielmals und wünsche viel gutes.
Viele Grüße,
Paul