Pagina 1 van 1

[NEW PROBLEM] Hoe een php file invoegen in een tpl file?

Geplaatst: 03 jul 2003, 11:01
door Deef
Op mijn site staat een werkende nieuws scrol... heel simpel en ik vind hem goed

http://www.glansbeton.be/forum/scroll.php

Maar hoe kan ik die php file nu invoegen in een tpl file

Ik weet hoe ik een kader moet maken... als je kijkt op

http://www.glansbeton.be/forum/portal.php

zie je links (tegenovergestelde van rechts :wink: )waar die link naar die news scroll moet komen...

Moets het jullie intresseren, hieronder heb ik het ook al gevraagd, maar we geraken niet aan een oplossing... kwestie dat het duidelijk is dat ik niet aan het crossposten ben...

http://www.phpbb.nl/phpBB/viewtopic.php ... highlight=

Geplaatst: 07 jul 2003, 14:26
door Deef
Dit topic, heb ik al zelf opgelost gekregen... maar nu de volgende vraag...

Die newsscroll loopt goed, maar enkel en alleen als je ingelogd bent, ben je niet ingelogd, dan zie je niks... Volgens mij komt dat omdat ik restricties heb gezet dat je alleen maar kunt lezen op het forum, als je ingelogd, bent. Ik zou deze restricties graag willen houden, maar het nieuwsforum zou dan nog wel moeten rouleren en de recente topics laten zien....

Iemand een idee? :roll:

Geplaatst: 07 jul 2003, 17:38
door mosymuis
deef schreef:Dit topic, heb ik al zelf opgelost gekregen...
Hoe dan?

Geplaatst: 08 jul 2003, 07:56
door Deef
mosymuis schreef: Hoe dan?
Door het volledig portal te downloaden, en daar zit wel een mod bij... maar volgens mij staat die mod nergens appart....

Nu dat scrollend newsforum, werkt goed... maar als jij gaat kijken zul je het niet zien, als je niet ingelogd bent... en dat vind ik spijtig.

Smartor geeft in de mod aan dat het portal een ingebouwde functie heeft om niet alle berichten te laten zien (bijvoorbeeld in een fora voor administrators)... is soms ideaal maar ik vind niet hoe ge die functie kunt uitzetten...

Geplaatst: 11 jul 2003, 10:46
door Deef
Nog altijd niemand die hiervoor een oplossing weet???

Geplaatst: 15 jul 2003, 07:50
door WebSiteNet
wat je nu hebt is dat hij op basis van permissies de berichten uit de forums haalt. wat jij moet hebben is dat hoij gewoon alle berichten er uit haalt. geef je code eens. kan ik er wat aan doen.

Geplaatst: 15 jul 2003, 10:09
door Deef
Onderstaand vind je de ganse code van het portal, ...

Ik hoop echt dat jij er uit wijs kunt... :lol:

Seg waar heb jij dat geleerd? Ik snap daar geen stimirol van...

Code: Selecteer alles

<?php
/***************************************************************************
 *                                portal.php
 *                            -------------------
 *   begin                : Tuesday, August 13, 2002
 *   copyright            : (C) 2002 Smartor
 *   email                : smartor_xp@hotmail.com
 *
 *   $Id: portal.php,v 2.1.7 2003/01/30, 17:05:58 Smartor Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   Some code in this file I borrowed from the original index.php, Welcome
 *   Avatar MOD and others...
 *
 ***************************************************************************/

//
// Set configuration for ezPortal
//

// Welcome Text: note that we are in PHP file, so use \' instead of ' and use \\ instead of \ (HTML enabled)
$CFG['welcome_text'] = 'Welkom op het forum van <b>Glansbeton BVBA</b><br /><br />Je vind hier alles over glansbeton of industrievloeren.<br />Ook hebben we een apparte sectie voor webdesign.<br /><br />Kijk ook eens op onze <a href="http://www.glansbeton.be" target="_top">flash site,</a> wij hopen dat U op onze site vindt wat U zoekt!<br /><br />Voordat U kunt lezen in ons forum, dient U zich te <a href="http://glansbeton.be/forum/profile.php?mode=register" target="_self">registreren</a>, dit is ingebouwd uit veiligheidsoverwegingen.<br /><br />Registratie is volkomen gratis en vrijblijvend. (Wij sturen U geen ongewenste reclame of geven uw mailadres niet door aan derden.)<br /><br /><br />Johny Renckens<br />voor Glansbeton BVBA';

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

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

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

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

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

// 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);// ChatBox Mod
include($phpbb_root_path . 'chatbox_front.php');





//
// 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'];
}

//
// Recent Topics
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
	$forum_data[] = $row;
}

$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);

if( $CFG['exceptional_forums'] == '' )
{
	$except_forum_id = '\'start\'';
}
else
{
	$except_forum_id = $CFG['exceptional_forums'];
}

for ($i = 0; $i < count($forum_data); $i++)
{
	if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
	{
		if ($except_forum_id == '\'start\'')
		{
			$except_forum_id = $forum_data[$i]['forum_id'];
		}
		else
		{
			$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
		}
	}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
		FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
		WHERE t.forum_id NOT IN (" . $except_forum_id . ")
			AND t.topic_status <> 2
			AND p.post_id = t.topic_last_post_id
			AND p.poster_id = u.user_id
		ORDER BY p.post_id DESC
		LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
	$recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
	$template->assign_block_vars('recent_topic_row', array(
		'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
		'L_TITLE' => $recent_topic_row[$i]['topic_title'],
		'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
		'S_POSTER' => $recent_topic_row[$i]['username'],
		'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
		)
	);
}
//
// END - Recent Topics
//

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'] . "&(" . $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' => 'portal_body.tpl')
);

//
// Avatar On Index MOD
//
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
	switch( $userdata['user_avatar_type'] )
	{
		case USER_AVATAR_UPLOAD:
			$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
			break;
		case USER_AVATAR_REMOTE:
			$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
			break;
		case USER_AVATAR_GALLERY:
			$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
			break;
	}
}
// Check For Anonymous User
if ($userdata['user_id'] != '-1')
{
	$name_link = '<a href="' . append_sid("profile.$phpEx?mode=editprofile&" . $userdata['user_id']) . '">' . $userdata['username'] . '</a>';
}
else
{
	$name_link = $lang['Guest'];
}
//
// END: Avatar On Index MOD
//


$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'],// ChatBox
	// Recent Topics
	'L_RECENT_TOPICS' => $lang['Recent_topics'],
	'L_WHO_IS_CHATTING' => $lang['Who_is_Chatting'],
	'TOTAL_CHATTERS_ONLINE' => sprintf($lang['How_Many_Chatters'], $howmanychat),
	'CHATTERS_LIST' => sprintf($lang['Who_Are_Chatting' ],$chatters),
	'L_LOGIN_TO_JOIN_CHAT' => $lang['Login_to_join_chat'],
	'L_CLICK_TO_JOIN_CHAT' => $lang['Click_to_join_chat'],
	'S_JOIN_CHAT' => append_sid("chatbox_mod/chatbox.$phpEx"),
	'CHATBOX_NAME' => $userdata['user_id'] . '_ChatBox',

	// 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
//

//
// Fetch Poll
//
$fetchpoll = phpbb_fetch_poll($CFG['poll_forum']);

if (!empty($fetchpoll))
{
	$template->assign_vars(array(		
		'S_POLL_QUESTION' => $fetchpoll['vote_text'],
		'S_POLL_ACTION' => append_sid('posting.'.$phpEx.'?'.POST_TOPIC_URL.'='.$fetchpoll['topic_id']),
		'S_TOPIC_ID' => $fetchpoll['topic_id'],
		'L_SUBMIT_VOTE' => $lang['Submit_vote'],
		'L_LOGIN_TO_VOTE' => $lang['Login_to_vote']		
		)
	);

	for ($i = 0; $i < count($fetchpoll['options']); $i++)
	{
		$template->assign_block_vars('poll_option_row', array(
			'OPTION_ID' => $fetchpoll['options'][$i]['vote_option_id'],
			'OPTION_TEXT' => $fetchpoll['options'][$i]['vote_option_text'],
			'VOTE_RESULT' => $fetchpoll['options'][$i]['vote_result'],
			)
		);
	}	
}
else
{
	$template->assign_vars(array(		
		'S_POLL_QUESTION' => $lang['No_poll'],
		'DISABLED' => 'disabled="disabled"'
		)
	);
}
//
// Generate the page
//
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);


?>

Geplaatst: 15 jul 2003, 10:37
door WebSiteNet
deef schreef:Seg waar heb jij dat geleerd? Ik snap daar geen stimirol van...
een flinke computer verslaving er op na houde en veel tuto's lezen.

find

Code: Selecteer alles

for ($i = 0; $i < count($forum_data); $i++) 
{ 
   if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])) 
   { 
      if ($except_forum_id == '\'start\'') 
      { 
         $except_forum_id = $forum_data[$i]['forum_id']; 
      } 
      else 
      { 
         $except_forum_id .= ',' . $forum_data[$i]['forum_id']; 
      } 
   } 
} 
en wijzig met

Code: Selecteer alles

 /* for ($i = 0; $i < count($forum_data); $i++) 
{ 
   if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])) 
   { 
      if ($except_forum_id == '\'start\'') 
      { 
         $except_forum_id = $forum_data[$i]['forum_id']; 
      } 
      else 
      { 
         $except_forum_id .= ',' . $forum_data[$i]['forum_id']; 
      } 
   } 
} */
dan zou het moete werken.

Geplaatst: 16 jul 2003, 08:02
door Deef
simpelscript schreef: dan zou het moete werken.
En het werkt, :thumb: geweldig, daar ben ik al even naar het zoeken,

echt bedankt, en het was blijkbaar zo simpel ! :lol:

Geplaatst: 23 okt 2003, 08:34
door Deef
Ik zit hier terug met een vraag over ditzelfde onderwerp...

Als jullie gaan kijken op http://www.glansbeton.be/forum/portal.php

Zien jullie dat deze mod (links) goed werkt bij mij...

Wat is dan het probleem????

Wel er staat altijd by davy... dat wil ik niet omdat ik op alle berichten antwoord... Het beste zou zijn dat hij ofwel mij eruit filtert..

Of misschien nog beter dat er echt komt te staan wie het bericht heeft opgesteld.
Hier is de code die in mijn portal_body.tpl file staat:

Code: Selecteer alles

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
         <tr> 
         <td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td> 
         </tr> 
         <tr> 
         <td class="row1" align="left"><span class="gensmall"> 
         <marquee id="recent_topics" behavior="scroll" direction="up" height="200" scrolldelay="100" scrollamount="2"> 
         <!-- BEGIN recent_topic_row --> 
         » <a href="{recent_topic_row.U_TITLE}" onmouseover="document.all.recent_topics.stop()" onmouseout="document.all.recent_topics.start()">{recent_topic_row.L_TITLE}</a><br /> 
         by <a href="{recent_topic_row.U_POSTER}" onmouseover="document.all.recent_topics.stop()" onmouseout="document.all.recent_topics.start()">{recent_topic_row.S_POSTER}</a> on {recent_topic_row.S_POSTTIME}<br /><br /> 
         <!-- END recent_topic_row --> 
         </marquee> 
         </span></td> 
         </tr> 
        </table> 
        
        <br /> 

Geplaatst: 23 okt 2003, 16:22
door Deef
deef schreef:Ik zit hier terug met een vraag over ditzelfde onderwerp...
Stond daar juist [solved] voor, had ik zelf niet gezien, natuurlijk gaat dan niemand antwoorden hé... :twisted:

Heb er maar voorlopig [new problem] van gemaakt