|
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. | NEI PREFERITI | .:: | RSS Forum | RSS News | NEWS web | NEWS software | |
| PUBBLICITA' | | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | | CERCA nel FORUM » | |
27-02-2006, 20.10.14 | #1 |
Forum supporter
Registrato: 03-04-2000
Loc.: Palermo
Messaggi: 1.554
|
Forum php
Nella pagina che visualizza i topic ( viewtopic.php), c'è la condizione per far apparire un'icona allato del topic non letto. la condizione è questa : [PHP] // // Define the little post icon // if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read ) { $mini_post_img = $images['icon_minipost_new']; $mini_post_alt = $lang['New_post']; } else { $mini_post_img = $images['icon_minipost']; $mini_post_alt = $lang['Post']; } $mini_post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '#' . $postrow[$i]['post_id']; // // Generate ranks, set them to empty string initially. // [/PHP] Ora io nell'index.php ho una tabella che mi fa visualizzare gli ultimi 5 topic, letti o non letti. Questo è il suo codice: [PHP] // // Integrated Toplist 1.0.3 by bu Based on OOHOO's ADV-TOP5 (20050119) // // This work is licensed under the Creative Commons Attribution-ShareAlike License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ // // MOD START // // Option of Toplist Start // // Topics text length $MAX_STR_LEN = 60; // Topics to display (Default: 5) $MAX_TOPICS = 5; // 0 => users can see all topics including authorized issue(but they cant read the posts) // 1 => users can see only authorized topics $AUTH_SECRUITY = 1; // Order by // topic_last_post_id (Default) // topic_replies // topic_views $sortby="topic_last_post_id"; // // Option of Toplist End // function cutStr($str) { global $MAX_STR_LEN; $str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str; return $str; } // Find which forums are visible for this user $is_auth_ary_top5 = array(); $is_auth_ary_top5 = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); $auth_forum_ary_top5 = array(); // Get forum info $sql = "SELECT forum_id FROM " . FORUMS_TABLE; if( !$q_forums = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch forum info fail', __LINE__, __FILE__, $sql); } // Authorized forums info while( $forum_row = $db->sql_fetchrow($q_forums) ) { $forum_id1 = $forum_row['forum_id']; if( $is_auth_ary_top5[$forum_id1]['auth_read'] == 1) { if(function_exists("array_push")) { array_push($auth_forum_ary_top5, $forum_id1); } else { $auth_id=count($auth_forum_ary_top5); $auth_forum_ary_top5[$auth_id]=$forum_id1; } } } if( sizeOf($auth_forum_ary_top5) == 0 || !$AUTH_SECRUITY ) { $auth_forums_top5 = ""; } else { $auth_forums_top5 = 'AND f.forum_id IN('; if(sizeOf($auth_forum_ary_top5) > 1) { $auth_forums_top5 .= implode (',', $auth_forum_ary_top5); } else { $auth_forums_top5 .= $auth_forum_ary_top5[0]; } $auth_forums_top5 .= ')'; } // query $sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f WHERE t.forum_id = f.forum_id AND topic_moved_id = '0' $auth_forums_top5 ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic info fail', __LINE__, __FILE__, $sql); } // fetch rows while( $rows = $db->sql_fetchrow($result) ) { $topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']); $forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']); $topic_poster = $rows['topic_poster']; $topic_last_post_id = $rows['topic_last_post_id']; // Grab topic poster and last replier data $sql = "SELECT post_username, user_id, username FROM " . POSTS_TABLE . ", " . USERS_TABLE . " WHERE topic_id = '" . $rows['topic_id'] . "' AND poster_id = user_id ORDER BY post_id LIMIT 0, 1"; if( !$p_result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic poster fail', __LINE__, __FILE__, $sql); } $p_row = $db->sql_fetchrow($p_result); $poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']); $poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u= $topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name; $sql = "SELECT post_username, user_id, username, post_time FROM " . POSTS_TABLE . ", " . USERS_TABLE . " WHERE post_id = '$topic_last_post_id' AND poster_id = user_id"; if( !$r_result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Toplist ERROR: Fetch topic last replier fail', __LINE__, __FILE__, $sql); } $r_row = $db->sql_fetchrow($r_result); $replier_id = $r_row['user_id']; $replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']); $replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u= $replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name; $last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id #$topic_last_post_id"); $template->assign_block_vars("toprow", array( 'FORUM_NAME' => $rows['forum_name'], 'FORUM_URL' => $forum_url, 'TOPIC' => cutStr($rows['topic_title']), 'TOPIC_URL' => $topic_url, 'TOPIC_VIEWS' => $rows['topic_views'], 'TOPIC_REPLIES' => $rows['topic_replies'], 'POST_TIME' => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']), 'POSTER_URL' => $poster_url, 'REPLIER_URL' => $replier_url, 'LAST_POST_URL' => $last_post_url )); } // MOD END // // Integrated Toplist 1.0.3 by bu Based on OOHOO's ADV-TOP5 (20050119) // [/php] Quali sono le modifiche da fare a Define the little post icon per far si che anche nella index.php appaia l'icona quando non sono letti ?. Grazie.
___________________________________
Home Page Un uomo è di valore nella misura in cui è in grado di aiutare gli altri. L. R. Hubbard - Non sai dove mettere le mani ? |
Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti) | |
|
|
Discussioni simili | ||||
Discussione | Autore discussione | Forum | Risposte | Ultimo messaggio |
Come mettere un forum su un sito? | peertoopeer | Programmazione | 5 | 07-02-2006 19.31.32 |
Quanti forum frequentate...? | Skorpios | Chiacchiere in libertà | 85 | 29-02-2004 18.31.02 |