Pagina 1 van 1

Nieuwsberichten van portal op een aparte pagina

Geplaatst: 06 apr 2006, 16:52
door Peacemaker
Ik heb nu als index portal.php met een zelfgemaakt menu, nu wil ik een iframe in het midden maken zodat ik de links hier target naar kan verwijzen.

Nu krijg ik echter het volgende als ik een iframe maak:

http://www.olympus-clan.net/Forum/portal.php

Waarin ik de iframe in het midden zo heb:

Code: Selecteer alles

<Iframe width="100%" src="news.php" frameborder="0">
</Iframe>
Met news.php de info van portal.php (ik weet niet of dit zo moet):

Code: Selecteer alles

<?php

// Number of news on portal
$CFG['number_of_news'] = '5';

// Length of news
$CFG['news_length'] = '800';

// News Forum ID: separate by comma for multi-forums, eg. '1,2,5'
$CFG['news_forum'] = '7';

// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
$CFG['poll_forum'] = '7';

// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '5';

// Exceptional Forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '';

//
// END configuration
// --------------------------------------------------------

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'fetchposts.'.$phpEx);



//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//


//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];

if( $total_posts == 0 )
{
	$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
	$l_total_post_s = $lang['Posted_article_total'];
}
else
{
	$l_total_post_s = $lang['Posted_articles_total'];
}

if( $total_users == 0 )
{
	$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
	$l_total_user_s = $lang['Registered_user_total'];
}
else
{
	$l_total_user_s = $lang['Registered_users_total'];
}



if( $userdata['session_logged_in'] )
{
	$sql = "SELECT COUNT(post_id) as total
			FROM " . POSTS_TABLE . "
			WHERE post_time >= " . $userdata['user_lastvisit'];
	$result = $db->sql_query($sql);
	if( $result )
	{
		$row = $db->sql_fetchrow($result);
		$lang['Search_new'] = $lang['Search_new'] . "&nbsp;(" . $row['total'] . ")";
	}
}

//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'news.tpl')
);

$template->assign_vars(array(
	'WELCOME_TEXT' => $CFG['welcome_text'],
	'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
	'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
	'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
	'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
	'L_FORUM' => $lang['Forum'],
	'L_BOARD_NAVIGATION' => $lang['Board_navigation'],
	'L_STATISTICS' => $lang['Statistics'],	
	'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
	'L_POSTED' => $lang['Posted'],
	'L_COMMENTS' => $lang['Comments'],
	'L_VIEW_COMMENTS' => $lang['View_comments'],
	'L_POST_COMMENT' => $lang['Post_your_comment'],
	'L_SEND_PASSWORD' => $lang['Forgotten_password'],
	'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
	'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'),
	'L_REMEMBER_ME' => $lang['Remember_me'],
	'L_VIEW_COMPLETE_LIST' => $lang['View_complete_list'],
	'L_POLL' => $lang['Poll'],
	'L_VOTE_BUTTON' => $lang['Vote'],
	// Recent Topics
	'L_RECENT_TOPICS' => $lang['Recent_topics'],
    // Top Poster
	'L_TOP_POSTER' => $lang['Top_poster'],
	
	// Welcome Avatar
	'L_NAME_WELCOME' => $lang['Welcome'],
	'U_NAME_LINK' => $name_link,
	'AVATAR_IMG' => $avatar_img)
);

//
// Fetch Posts from Announcements Forum
//
if(!isset($HTTP_GET_VARS['article']))
{
	$template->assign_block_vars('welcome_text', array());

	$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], $CFG['news_length']);

	for ($i = 0; $i < count($fetchposts); $i++)
	{
		if( $fetchposts[$i]['striped'] == 1 )
		{
			$open_bracket = '[ ';
			$close_bracket = ' ]';
			$read_full = $lang['Read_Full'];
		}
		else
		{
			$open_bracket = '';
			$close_bracket = '';
			$read_full = '';
		}

		$template->assign_block_vars('fetchpost_row', array(
			'TITLE' => $fetchposts[$i]['topic_title'],
			'POSTER' => $fetchposts[$i]['username'],
			'TIME' => $fetchposts[$i]['topic_time'],
			'TEXT' => $fetchposts[$i]['post_text'],
			'REPLIES' => $fetchposts[$i]['topic_replies'],
			'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
			'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id']),
			'U_READ_FULL' => append_sid('portal.' . $phpEx . '?article=' . $i),
			'L_READ_FULL' => $read_full,
			'OPEN' => $open_bracket,

			'CLOSE' => $close_bracket)
		);
	}
}
else
{
	$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);

	$i = intval($HTTP_GET_VARS['article']);

	$template->assign_block_vars('fetchpost_row', array(
		'TITLE' => $fetchposts[$i]['topic_title'],
		'POSTER' => $fetchposts[$i]['username'],
		'TIME' => $fetchposts[$i]['topic_time'],
		'TEXT' => $fetchposts[$i]['post_text'],
		'REPLIES' => $fetchposts[$i]['topic_replies'],
		'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
		'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id'])
		)
	);
}
//
// END: Fetch Announcements
//

//
// Generate the page
//
$template->pparse('body');

?>
En dan news.tpl de standaard fetchpost code met wat images:

Code: Selecteer alles

<style type="text/css"> 
body { background-image: url(http://www.olympus-clan.net/Forum/images/hout.jpg);} 
</style>

<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="#302A1D" >
					
		<tr>
		  <td background="http://www.olympus-clan.net/Forum/images/news_midden.jpg" align="left" border="0"><img src="http://www.olympus-clan.net/Forum/images/news_links.jpg" border="0" width="50" height="39"></td>
			<td background="http://www.olympus-clan.net/Forum/images/news_midden.jpg" align="center" border="0"><b><FONT COLOR="C8C8C8">{fetchpost_row.TITLE}</b></FONT></td>
			<td background="http://www.olympus-clan.net/Forum/images/news_midden.jpg" align="right" border="0"><img src="http://www.olympus-clan.net/Forum/images/news_rechts.jpg" border="0" width="50" height="39"></td>
		</tr>
		<tr>
		  <td colspan="3"><center>
		  
		   <table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="#302A1D" >
				<tr>
		  	 <td background="http://www.olympus-clan.net/Forum/images/news2.jpg" width="12" align="left"><img src="http://www.olympus-clan.net/Forum/images/news1.jpg" width="12" height="25"></td>
				 <td background="http://www.olympus-clan.net/Forum/images/news2.jpg" align="left"><FONT color="#000000">{L_POSTED}: <b>{fetchpost_row.POSTER}</b> @ {fetchpost_row.TIME}</FONT></td>
				 <td background="http://www.olympus-clan.net/Forum/images/news2.jpg" width="12" align="right"><img src="http://www.olympus-clan.net/Forum/images/news3.jpg" width="12" height="25"></td>
				</tr>
				<tr>
				 <td background="http://www.olympus-clan.net/Forum/images/news4.jpg" width="12"></td>
				 <td background="http://www.olympus-clan.net/Forum/images/bg_news.jpg" align="left"><FONT color="#000000"><hr color="#B2A183">{fetchpost_row.TEXT}<br /><br />{fetchpost_row.OPEN}<a href="{fetchpost_row.U_READ_FULL}">{fetchpost_row.L_READ_FULL}</a>{fetchpost_row.CLOSE}</FONT></td>
				 <td background="http://www.olympus-clan.net/Forum/images/news6.jpg" width="12"></td>
				</tr>
				<tr>
		  	 <td background="http://www.olympus-clan.net/Forum/images/news8.jpg" width="12" align="left"><img src="http://www.olympus-clan.net/Forum/images/news7.jpg" width="12" height="25"></td>
				 <td background="http://www.olympus-clan.net/Forum/images/news8.jpg" align="left"><FONT color="#000000">{L_COMMENTS}: {fetchpost_row.REPLIES} :: <a href="{fetchpost_row.U_VIEW_COMMENTS}">{L_VIEW_COMMENTS}</a> (<a href="{fetchpost_row.U_POST_COMMENT}">{L_POST_COMMENT}</a>)</FONT></td>
				 <td background="http://www.olympus-clan.net/Forum/images/news8.jpg" width="12" align="right"><img src="http://www.olympus-clan.net/Forum/images/news9.jpg" width="12" height="25"></td>
				
		   </table>
		   		 
		  </center></td>
		</tr>
		</table>
Maar zoals op http://www.olympus-clan.net/Forum/portal.php te zien is verschijnen de announcements leeg erop :? .

Weet iemand hoe dit komt, ik weet zelf eigenlijk niet eens of ik dit zo goed heb gedaan :oops:

Geplaatst: 07 apr 2006, 00:20
door Peacemaker
Iemand?

Geplaatst: 07 apr 2006, 12:15
door Peacemaker
:(