2nd, 3rd, 4th (etc) Portals?

Current Version: 1.0.6
Released: 09.01.10
Forum rules
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

2nd, 3rd, 4th (etc) Portals?

Post by Bash »

Your Portal Version: 1.0.5
Your phpBB Type: Standard phpBB3
MODs installed: No
Your knowledge: Beginner

What have you done before the problem was there?


What have you already tryed to solve the problem?


Description and Message
Is it possible to have mulitple portals on the same site? (and renaming the additional portals)

Thanks.
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Marc »

It is certainly not impossible, but you would have to edit a lot of files.

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

I can do that :D

So extra portals wouldn't require any additional installs/SQL queries, it's just a case of re-creating the portal files, renaming them and editing them?

The problem I'm faced with at the moment, is if I start moving portal blocks to different custom pages, I have to edit the main portal file (forget which now) to exclude the blocks from the main portal to prevent duplicates (instead of disabling them through ACP) and of course, the changes I make to the portal page in ACP would effect the custom pages which is fine so long as I remember which block is where etc etc (but I want to do it properly).

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

Ok I found an easier option for my needs. I created a seperate menu within ACP Mods tab and added the new duplicated/renamed modules which will make it a little more organised (I didn't want to manage modules for custom pages within the portal menu).

I managed to create a module duplicated from the news module (called 'Results') and another module duplicated from the recent posts module (called 'Streams'). Heres how it looks so far: http://www.worldclanleague.com/forum/wcl.php

Now then, I have another problem...

I tried to add another block/module (called 'Videos') which is exactly the same as the streams module/block (or recent posts) but, what happened was, both the 'Streams' & 'Videos' blocks results merged - both displaying recent posts defined by each seperate module within ACP.

Let me try and explain it easier

In ACP

Module1 is pulling posts from 'Forum1'
Module2 is pulling posts from 'Forum2'

Result

Module1 (Streams block) is displaying posts from 'Forum1' & 'Forum2'
Module2 (Videos block) is pulling posts from 'Forum1' & 'Forum2'

I find it puzzling... I think it's because both the blocks are on the same page (the portal.php 'recent results' block isn't displaying the 'streams' blocks posts and vice-versa).

Sorry to bother you again, but can someone please advise me on how I can seperate these modules properly, so that their output isn't merged?

Thank you.
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Marc »

Please post the code of the blocks files of your stream & videos block, and the template files of those 2 blocks.

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

*is optimistic* :D

Streams.php

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: streams.php 589 2009-12-04 21:11:16Z marc1706 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

//
// Exclude forums
//
$sql_where = '';
if ($portal_config['portal_streams_forum'] > 0)
{
	$exclude_forums = explode(',', $portal_config['portal_streams_forum']);
	
	$sql_where = ' AND ' . $db->sql_in_set('forum_id', $exclude_forums, ($portal_config['portal_exclude_forums']) ? true : false);
}

// Get a list of forums the user cannot read
$forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));

// Determine first forum the user is able to read (must not be a category)
$sql = 'SELECT forum_id
	FROM ' . FORUMS_TABLE . '
	WHERE forum_type = ' . FORUM_POST;

$forum_sql = '';
if (sizeof($forum_ary))
{
	$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
	$forum_sql = ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary, true);
}

$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');

//
// Streams announcements
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_status <> ' . FORUM_LINK . '
		AND topic_approved = 1 
		AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ')
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
	ORDER BY topic_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_announcements', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_streams_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

//
// Streams hot topics
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_approved = 1 
		AND topic_replies >=' . $config['hot_threshold'] . '
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
	ORDER BY topic_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_hot_topics', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_streams_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

//
// Streams topic (only show normal topic)
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_status <> ' . ITEM_MOVED . '
		AND topic_approved = 1 
		AND topic_type = ' . POST_NORMAL . '
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
	ORDER BY topic_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_topics', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_streams_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

$template->assign_var('S_DISPLAY_STREAMS', true);

?>
Videos.php

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: videos.php 589 2009-12-04 21:11:16Z marc1706 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

//
// Exclude forums
//
$sql_where = '';
if ($portal_config['portal_videos_forum'] > 0)
{
	$exclude_forums = explode(',', $portal_config['portal_videos_forum']);
	
	$sql_where = ' AND ' . $db->sql_in_set('forum_id', $exclude_forums, ($portal_config['portal_exclude_forums']) ? true : false);
}

// Get a list of forums the user cannot read
$forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));

// Determine first forum the user is able to read (must not be a category)
$sql = 'SELECT forum_id
	FROM ' . FORUMS_TABLE . '
	WHERE forum_type = ' . FORUM_POST;

$forum_sql = '';
if (sizeof($forum_ary))
{
	$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
	$forum_sql = ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary, true);
}

$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');

//
// Videos announcements
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_status <> ' . FORUM_LINK . '
		AND topic_approved = 1 
		AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ')
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
	ORDER BY topic_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_announcements', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_videos_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

//
// Videos hot topics
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_approved = 1 
		AND topic_replies >=' . $config['hot_threshold'] . '
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
	ORDER BY topic_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_hot_topics', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_videos_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

//
// Videos topic (only show normal topic)
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_status <> ' . ITEM_MOVED . '
		AND topic_approved = 1 
		AND topic_type = ' . POST_NORMAL . '
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
	ORDER BY topic_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_topics', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_videos_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

$template->assign_var('S_DISPLAY_VIDEOS', true);

?>
Streams.html

Code: Select all

<!--version $Id: streams.html 503 2009-04-20 18:34:29Z kevin74 $ //-->
<!-- IF .latest_announcements or .latest_hot_topics or .latest_topics -->
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_stats.png" width="16" height="16" alt="" />&nbsp;<!-- ENDIF -->Streams{$LR_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">

	<tr class="row1">
	    <td class="row1" width="100%" valign="top">
		<!-- IF .latest_announcements -->
			<!-- BEGIN latest_announcements -->
						<a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}">{latest_announcements.TITLE}</a><br />
			<!-- END latest_announcements -->
		<!-- ENDIF -->
		<!-- IF .latest_hot_topics -->
			<!-- BEGIN latest_hot_topics -->
				        <a href="{latest_hot_topics.U_VIEW_TOPIC}" title="{latest_hot_topics.FULL_TITLE}">{latest_hot_topics.TITLE}</a><br />
			<!-- END latest_hot_topics -->
		<!-- ENDIF -->
		<!-- IF .latest_topics -->
			<!-- BEGIN latest_topics -->
				        <a href="{latest_topics.U_VIEW_TOPIC}" title="{latest_topics.FULL_TITLE}">{latest_topics.TITLE}</a><br />
			<!-- END latest_topics -->
		</td>
		<!-- ENDIF -->
	</tr>
</table>
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
<!-- ENDIF -->
videos.html

Code: Select all

<!--version $Id: videos.html 503 2009-04-20 18:34:29Z kevin74 $ //-->
<!-- IF .latest_announcements or .latest_hot_topics or .latest_topics -->
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_stats.png" width="16" height="16" alt="" />&nbsp;<!-- ENDIF -->Recent videos{$LR_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">

	<tr class="row1">
	    <td class="row1" width="100%" valign="top">
		<!-- IF .latest_announcements -->
			<!-- BEGIN latest_announcements -->
						<a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}">{latest_announcements.TITLE}</a><br />
			<!-- END latest_announcements -->
		<!-- ENDIF -->
		<!-- IF .latest_hot_topics -->
			<!-- BEGIN latest_hot_topics -->
				        <a href="{latest_hot_topics.U_VIEW_TOPIC}" title="{latest_hot_topics.FULL_TITLE}">{latest_hot_topics.TITLE}</a><br />
			<!-- END latest_hot_topics -->
		<!-- ENDIF -->
		<!-- IF .latest_topics -->
			<!-- BEGIN latest_topics -->
				        <a href="{latest_topics.U_VIEW_TOPIC}" title="{latest_topics.FULL_TITLE}">{latest_topics.TITLE}</a><br />
			<!-- END latest_topics -->
		</td>
		<!-- ENDIF -->
	</tr>
</table>
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
<!-- ENDIF -->
Really appreciate this, I will have to buy you a drink for all the help you give to everyone ;)

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

No?

(sorry to be impatient)
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Marc »

You are overwriting your block's block vars. Take a look here, maybe that clears it up for you (especially the assign_block_vars):
http://wiki.phpbb.com/display/MODDOCS/T ... ate+syntax

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

No idea what I'm looking at there tbh :(
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Marc »

Ok, I'll give you an example. You have this code in your streams block:

Code: Select all

      $template->assign_block_vars('latest_announcements', array(
         'TITLE'         => character_limit($row['topic_title'], $portal_config['portal_streams_title_limit']),
         'FULL_TITLE'   => censor_text($row['topic_title']),
         'U_VIEW_TOPIC'   => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
      ));
You are assigning block vars to the block "latest_announcements". At the same time, you have this code in your video block:

Code: Select all

      $template->assign_block_vars('latest_announcements', array(
         'TITLE'         => character_limit($row['topic_title'], $portal_config['portal_videos_title_limit']),
         'FULL_TITLE'   => censor_text($row['topic_title']),
         'U_VIEW_TOPIC'   => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
      ));
So you are writing to the same block. The problem is, that you are actually overwriting the initial "latest_announcements" block. So in order to fix this, you will have to choose different names for your template blocks. Once you have done that in the php files, you will also have to that in the HTML files.
For example if your change your block name to 'latest_announcements_videos', you will have to change this in the HTML file:

Code: Select all

      <!-- IF .latest_announcements_videos -->
         <!-- BEGIN latest_announcements_videos -->
                  <a href="{latest_announcements_videos.U_VIEW_TOPIC}" title="{latest_announcements_videos.FULL_TITLE}">{latest_announcements_videos.TITLE}</a><br />
         <!-- END latest_announcements_videos -->
      <!-- ENDIF -->

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

Thank you so much Marc <3

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

Hello Marc,

I'm now trying to install a second portal, which I've renamed wcl. I've renamed every instance of portal and PORTAL to wcl and WCL within the files respectively. I also renamed language/en/mods/additional_blocks.php and info_acp_additional_blocks.php to additional_wcl_blocks and info_acp_additional_wcl_blocks.php respectively, and all references to those files in the other files (to avoid overwriting).

After installing, the forum went down:

Code: Select all

Fatal error: Cannot redeclare phpbb_fetch_posts() (previously declared in /home/neblncbt/public_html/forum/portal/includes/functions.php:61) in /home/neblncbt/public_html/forum/wcl/includes/functions.php on line 323
The additions I made to functions.php which cause this, were:

Code: Select all

// Portal
	$user->add_lang(array('mods/lang_portal', 'mods/additional_blocks'));
	if (!function_exists('obtain_portal_config'))
	{
		include($phpbb_root_path . 'portal/includes/functions.' . $phpEx);
	}
	if(sql_table_exists(PORTAL_CONFIG_TABLE) == true)
	{
		$portal_config = obtain_portal_config();
	}
	
// WCL
	$user->add_lang(array('mods/lang_wcl', 'mods/additional_wcl_blocks'));
	if (!function_exists('obtain_wcl_config'))
	{
		include($phpbb_root_path . 'wcl/includes/functions.' . $phpEx);
	}
	if(sql_table_exists(WCL_CONFIG_TABLE) == true)
	{
		$wcl_config = obtain_wcl_config();
	}
And clue as to what I could try?

Thanks very much :)

Topic author
Bash
Active Member
Posts: 21
Joined: 11. May 2010 16:46
phpBB.de User: Bash
phpBB.com User: Bash

Re: 2nd, 3rd, 4th (etc) Portals?

Post by Bash »

Fixed. I just had to rename all the functions within portal/includes/functions.php.

matius
Active Member
Posts: 5
Joined: 29. January 2010 16:47

Re: 2nd, 3rd, 4th (etc) Portals?

Post by matius »

Can anyone tell how to do it step by step? He was very grateful because I'm not too good this :(
Locked

Return to “board3 Portal 1.0.x - English Support”