Noutati & Discutii recente (At-A-Glance)

Discuţii legate de instalarea şi funcţionarea unor MODificări vechi sau noi ale forumului phpBB 2.0.x.
Închis
Avatar utilizator
seelview
Fost coleg
Mesaje: 2146
Membru din: 13-Apr-2005, 21:24:50
Versiune: 3.x
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Foarte experimentat
Localitate: Cu curu' pe scaun
Contact:

Mesaj de seelview »

"Don't have fear, I is here"
Seelview Photography / Blog this
csaba
Utilizator înregistrat
Mesaje: 88
Membru din: 20-Ian-2006, 10:25:44

Mesaj de csaba »

asta am facut-o deja, dupa sugestia lui Alinutz.

glance.php-ul acum arata asa:

Cod: Selectaţi tot

<php>sql_fetchrow($result);
		if ( 1 )
		{
			$sql_select = ", p.post_time";
			$sql_from = ", " . POSTS_TABLE . " p";
			$sql_where = " AND p.post_id = t.topic_last_post_id";
		}
		$sql = "SELECT t.topic_id, t.topic_title, t.topic_time" . $sql_select . "
			FROM " . TOPICS_TABLE . " t" . $sql_from . "
			WHERE t.forum_id = " . $glance_news_forum_id . $sql_where . "
				AND t.topic_moved_id = 0
			ORDER BY t.topic_first_post_id DESC
			LIMIT " . $glance_num_news;
		if( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not query new news information", "", __LINE__, __FILE__, $sql);
		}
		$latest_news = array();
		while ( $topic_row = $db->sql_fetchrow($result) )
		{
			$topic_row['topic_title'] = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_row['topic_title']) : $topic_row['topic_title'];
			$latest_news[] = $topic_row;
		}
		$db->sql_freeresult($result);
	}
	
	//
	// GET THE LAST 5 TOPICS
	//
	if ( $glance_num_recent )
	{
		$unauthed_forums = array();
		$sql = "SELECT forum_id, auth_view FROM " . FORUMS_TABLE . " WHERE forum_id <glance_news_forum_id>sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not query new topic information", "", __LINE__, __FILE__, $sql);
		}
		$glance_auth_level = ( $glance_auth_read ) ? AUTH_VIEW : AUTH_ALL;

		$is_auth_ary = auth($glance_auth_level, AUTH_LIST_ALL, $userdata);
		
		$forumsignore = '';

		if ( $num_forums = count($is_auth_ary) )
		{
			while ( list($forum_id, $auth_mod) = each($is_auth_ary) )
			{
				$unauthed = false;
				if ( !$auth_mod['auth_view'] && $auth_mod['forum_id'] != $glance_news_forum_id )
				{
					$unauthed = true;
				}
				if ( !$glance_auth_read && !$auth_mod['auth_read'] && $auth_mod['forum_id'] != $glance_news_forum_id )
				{
					$unauthed = true;
				}
				if ( $unauthed )
				{
					$forumsignore .= $forum_id . ', ';
				}
			}
		}
		
		$sql = "SELECT
                   t.topic_title,
                   t.topic_id,
                   t.topic_time,
                   t.topic_replies,
                   p2.post_time,
                   u.username,
                   u.user_id
             FROM
                   " . POSTS_TABLE . " p,
                   " . TOPICS_TABLE . " t,
                   " . POSTS_TABLE . " p2,
                   " . USERS_TABLE . " u
             WHERE
                   t.forum_id NOT IN (" . $forumsignore . $glance_news_forum_id . ") AND
                   p.post_id = t.topic_first_post_id AND
                   p2.post_id = t.topic_last_post_id AND
                   t.topic_type <POST_ANNOUNCE>sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not query latest topic information", "", __LINE__, __FILE__, $sql);
		}
		$latest_topics = array();
		while ( $topic_row = $db->sql_fetchrow($result) )
		{
			$topic_row['topic_title'] = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_row['topic_title']) : $topic_row['topic_title'];
			$latest_topics[] = $topic_row;
		}
		$db->sql_freeresult($result);
	}
	
	//
	// BEGIN OUTPUT
	//
	$template->set_filenames(array(
		'glance_output' => 'glance_body.tpl')
	);
	
	if ( $glance_num_news )
	{
		if ( !empty($latest_news) )
		{
			$bullet_pre = 'glance_news_bullet';
			
			for ( $i = 0; $i <count> $glance_last_visit )
					{
						$unread_topics = true;
						if( !empty($tracking_topics[$topic_id]) && $glance_track )
						{
							if( $tracking_topics[$topic_id] >= $latest_news[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}
					}
					$shownew = $unread_topics;
				}
				else
				{
					$unread_topics = false;
					$shownew = true;
				}

				$bullet_full = $bullet_pre . ( ( $shownew && $glance_show_new_bullets ) ? '_new' : '_old' );

				$newest_code = ( $unread_topics && $glance_show_new_bullets ) ? '&view=newest' : '';
				
				$topic_link = $glance_forum_dir . 'viewtopic.php?t=' . $latest_news[$i]['topic_id'] . $newest_code;
$topic_autor_id = $glance_forum_dir . 'profile.php?mode=viewprofile&u=' . $latest_topics[$i]['user_id'];
$topic_autor = $latest_topics[$i]['username'];
$topic_replies = $latest_topics[$i]['topic_replies'];
				
				$template->assign_block_vars('news', array(
					'BULLET' => $$bullet_full,					
					'TOPIC_TITLE' => $latest_news[$i]['topic_title'],
					'TOPIC_LINK' => $topic_link,
	'TOPIC_AUTOR_ID' => $topic_autor_id,
                    'TOPIC_AUTOR' => $topic_autor,
                    'TOPIC_REPLIES' => $topic_replies,				
					'TOPIC_TIME' => create_date($lang['DATE_FORMAT'], $latest_news[$i]['topic_time'], $board_config['board_timezone']))
					);
			}
		}
		else
		{
			$template->assign_block_vars('news', array(
			'BULLET' => $glance_recent_bullet_old,
					
			'TOPIC_TITLE' => 'None')
			);
		}
	}
	
	if ( $glance_num_recent )
	{
		$glance_info = 'counted recent';
		$bullet_pre = 'glance_recent_bullet';

		if ( !empty($latest_topics) )
		{
			for ( $i = 0; $i <count> $glance_last_visit )
					{
						$unread_topics = true;
						if( !empty($tracking_topics[$topic_id]) && $glance_track )
						{
							if( $tracking_topics[$topic_id] >= $latest_topics[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}
					}
					$shownew = $unread_topics;
				}
				else
				{
					$unread_topics = false;
					$shownew = true;
				}

				$bullet_full = $bullet_pre . ( ( $shownew && $glance_show_new_bullets ) ? '_new' : '_old' );

				$newest_code = ( $unread_topics && $glance_show_new_bullets ) ? '&view=newest' : '';
				
				$topic_link = $glance_forum_dir . 'viewtopic.php?t=' . $latest_topics[$i]['topic_id'] . $newest_code;
				
				$template->assign_block_vars('recent', array(
					'BULLET' => $$bullet_full,
					'TOPIC_LINK' => $topic_link,
					
					'TOPIC_TITLE' => $latest_topics[$i]['topic_title'])
					);
			}
		}
		else
		{
			$template->assign_block_vars('recent', array(
			'BULLET' => $glance_recent_bullet_old,
					
			'TOPIC_TITLE' => 'None')
			);
		}
	}
	
	if ( $glance_num_news )
	{
		$template->assign_block_vars('switch_glance_news', array());
	}
	if ( $glance_num_recent )
	{
		$template->assign_block_vars('switch_glance_recent', array());
	}

	$template->assign_vars(array(
		'RECENT_HEADING' => $glance_recent_heading,
		
		'NEWS_HEADING' => $glance_news_heading)
		);
		
	$template->assign_var_from_handle('GLANCE_OUTPUT', 'glance_output');
	
// THE END
?>
Trebuie sa fie undeva o greseala, dar nu-i dau de capat nicicum.
Avatar utilizator
Aliniuz
Fost coleg
Mesaje: 3629
Membru din: 19-Mai-2006, 08:06:42
Ext: Nu
Server: Windows
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: Galati
Contact:

Mesaj de Aliniuz »

csaba scrie:
asta am facut-o deja, dupa sugestia lui Alinutz.
Trebuie sa fie undeva o greseala, dar nu-i dau de capat nicicum.
Te rog, nu-mi poci numele.... dar nu te intrista, nu esti primul care mi-l stalceste ! :lol:
exact la inceput in loc de

Cod: Selectaţi tot

<php>
ar trebui

Cod: Selectaţi tot

<?php
csaba
Utilizator înregistrat
Mesaje: 88
Membru din: 20-Ian-2006, 10:25:44

Mesaj de csaba »

Sorry, Aliniuz! :D

Era deja asa cum ai zis tu cu

Cod: Selectaţi tot

<?php

Dar cand copiez din glance.php intreaga sintaxa cu code aici imi apare trunchiat, nu inteleg de ce.

Primele cateva linii pana la

Cod: Selectaţi tot

sql_fetchrow($result); 
sunt taiate si apare in forma cum o vezi in postul meu anterior :shock:
Avatar utilizator
Aliniuz
Fost coleg
Mesaje: 3629
Membru din: 19-Mai-2006, 08:06:42
Ext: Nu
Server: Windows
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: Galati
Contact:

Mesaj de Aliniuz »

csaba scrie:Sorry, Aliniuz! :D

Era deja asa cum ai zis tu cu

Cod: Selectaţi tot

<?php

Dar cand copiez din glance.php intreaga sintaxa cu code aici imi apare trunchiat, nu inteleg de ce.

Primele cateva linii pana la

Cod: Selectaţi tot

sql_fetchrow($result); 
sunt taiate si apare in forma cum o vezi in postul meu anterior :shock:
Atunci posteaza un link cu versiunea text sau arhivata a fisierului .
csaba
Utilizator înregistrat
Mesaje: 88
Membru din: 20-Ian-2006, 10:25:44

Mesaj de csaba »

flowers
AdministratorAdministrator
Mesaje: 4641
Membru din: 03-Iun-2004, 17:50:34
Ext: Nu
Server: Windows
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: Bucureşti, România
Contact:

Mesaj de flowers »

Am corectat in articol

Cod: Selectaţi tot

// FORUM DIRECTORY - numele directorului în care se găseşte forumul
$glance_forum_dir = '/phpBB2/'; 
Multumim.
csaba
Utilizator înregistrat
Mesaje: 88
Membru din: 20-Ian-2006, 10:25:44

Mesaj de csaba »

Tot nu reusesc sa rezolv problema cu

Cod: Selectaţi tot

scris de:
() comentarii
Daca cineva vede unde e greseala in sintaxa pls help ca incep sa-mi iasa peri albi.
csaba
Utilizator înregistrat
Mesaje: 88
Membru din: 20-Ian-2006, 10:25:44

Mesaj de csaba »

Sau daca nu se poate rezolva sa apara numele autorului mesajului si numarul de mesaje, atunci macar spuneti-mi va rog cum sa fac sa dispara partea cu

scris de:
() comentarii
ca nu e prea estetic asa.
Avatar utilizator
Aliniuz
Fost coleg
Mesaje: 3629
Membru din: 19-Mai-2006, 08:06:42
Ext: Nu
Server: Windows
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: Galati
Contact:

Mesaj de Aliniuz »

csaba scrie:Sau daca nu se poate rezolva sa apara numele autorului mesajului si numarul de mesaje, atunci macar spuneti-mi va rog cum sa fac sa dispara partea cu

scris de:
() comentarii
ca nu e prea estetic asa.
Se poate... fii sigur ca ai omis o etapa din cele precizate de ai aceasta "eroare" .
Închis

Înapoi la “2.0.x Suport pentru MODificări”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 5 vizitatori