Page 1 of 59

[ABD] Sub forums for 2.0.4

Posted: Sun Sep 22, 2002 10:21 am
by DoubleDoom
This mod was originally designed for phpbb 2.0.0 by Martin K. Each version of phpbb has changed the code in different ways and required the sub-forum code to be updated accordintly.

This thread started off when phpbb2.0.2 was available and has progressed through to the current version 2.0.4.

What it does: It allows the creation of sub-forums and therefore reduces the number of forums you need to have listed on the main index.

Original Author: MartinK - full credit goes to Martin for this popular mod.
Updates and further development by myself and Ralendil (anyone else who wants to chip in, please discuss in this thread. Any improvements or changes welcome).

Examples of real forums using it:

http://www.civs.org/index.php (french)
http://forum.wolfservers.com/index.php
http://webserv.upb.de/universal/forum/index.php (german)
http://t4cministries.com/php/boards/index.php
http://www.eliteforums.com/
http://www.zona-zero.com/foro/ (spanish)
http://forums.servehalflife.com

Latest version of code for phpbb2.0.4 only: = 0.9.48 - 25th Jan 2003
Download from: http://doubledoom.org.uk/files/hierarchies204.zip

The latest download contains:
Full instructions to install manually
Already modified 2.0.4 subSilver files (for those with no other mods installed)
Required files to use the mod.
db_installer

Known issues.

1 - Somtimes when deleting a forum which has once housed a sub-catagory, the forum/catagory will not delete correctly. If this happens, go into phpmyadmin and check the catagories and forums group and delete the forum in there. Workaround to prevent this happening is to delete backwards, one at a time and not (sub)catagories that contain forums. Only delete the sub catagory when there is no forum in it.

2 - this is a long detailed mod and instructions are for subsilver. If you have another template, you will need to alter some of the instructions to suit your template. Index_body_sub.tpl is just a copy of the index_body.tpl with the whosonline table removed. So, if you are using another template then copy and rename the copy to index_body_sub.tpl and it will be fine. If you are confident, you can remove the whosonline if you wish. If you are not confident, you can leave it in with no side effects.

Personally, i am not able to support this mod as much as i used to as my site at http://www.new-version.org.uk now uses VBB in place of PHPBB. MartinK is still around from time to time as are other helpful peeps who will offer support.

Posted: Sun Sep 22, 2002 12:01 pm
by Ralendil
you can add the mine also as an example.

http://www.civs.org/index.php

Great thx for the how to ;)

Posted: Sun Sep 22, 2002 1:18 pm
by Manutencao

Posted: Sun Sep 22, 2002 1:27 pm
by DoubleDoom


Your board is a 2.0.1 version. Have you installed the 2.0.2 code on your board or have you installed the 2.0.0 version?

Posted: Sun Sep 22, 2002 4:28 pm
by Manutencao
DoubleDoom wrote:


Your board is a 2.0.1 version. Have you installed the 2.0.2 code on your board or have you installed the 2.0.0 version?


Ny my board is 2.0.2 version, but is prolem! No help! :(

Posted: Sun Sep 22, 2002 4:38 pm
by DoubleDoom
Manutencao wrote:
DoubleDoom wrote:


Your board is a 2.0.1 version. Have you installed the 2.0.2 code on your board or have you installed the 2.0.0 version?


Ny my board is 2.0.2 version, but is prolem! No help! :(


The error looks like a couple of things but i would start by looking at the SQL entries. Have you installed all 4 SQL commands into your database?

Have you installed the 2.0.0 version or the 2.0.2 version?

Hierarchies and Reduced Categories

Posted: Mon Sep 23, 2002 2:00 pm
by tuck
I was thinking if there can be a conflict between hierarchies and Reduced categories (by moonbase http://www.phpbb.kicks-ass.net/forum/index.php)
For example on index.php you wrote:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 

			$template->assign_block_vars('catrow', array(
				'CAT_ID' => $cat_id,
				'CAT_DESC' => $category_rows[$i]['cat_title'],
				'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
			);
While I have (I installed the reduced categories of course):

Code: Select all

	$template->assign_block_vars("catrow", array( 
				'CAT_ID' => $cat_id, 
				'CAT_DESC' => $cat_title, 
				'CAT_REDUCED_IMG' => $cat_reduced_img,
				'U_CAT_REDUCED' => $cat_reduced_url,
				'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id")) 
			);
Thanks a lot in advance.

Can't find code

Posted: Mon Sep 23, 2002 3:12 pm
by tuck

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/functions_admin.php

# 
#-----[ FIND ]------------------------------------------ 
# 

$sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total 
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE  . " t 
WHERE p.forum_id = $id 
AND t.topic_id = p.topic_id 
AND t.topic_status <> " . TOPIC_MOVED;
While I have

Code: Select all

$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total 
FROM " . POSTS_TABLE . "  
WHERE forum_id = $id";
And

Code: Select all

$sql = "SELECT COUNT(topic_id) AS total
FROM " . TOPICS_TABLE . "
WHERE forum_id = $id 
AND topic_status <> " . TOPIC_MOVED;
While I have

Code: Select all

$sql = "SELECT COUNT(topic_id) AS total
FROM " . TOPICS_TABLE . "
WHERE forum_id = $id";
Then you mentioned in the files to modify

Code: Select all

\templates\subSilver\index_body.tpl
##   \templates\subSilver\jumpbox.tpl
##   \templates\subSilver\overall_header.tpl
##   \templates\subSilver\posting_body.tpl
##   \templates\subSilver\viewforum_body.tpl
##   \templates\subSilver\viewtopic_body.tpl
##   \templates\subSilver\admin\category_edit_body.tpl
##   \templates\subSilver\admin\forum_admin_body.tpl
##   \templates\subSilver\admin\forum_delete_body.tpl
##   \templates\subSilver\admin\forum_edit_body.tpl
##   \templates\subSilver\admin\page_header.tpl
but they are not in the How-to :?:
Maybe you mean we have to copy and paste the ones you provide in the zip, but what for those with boards already modded?

Thanks a lot in advance.

Re: Hierarchies and Reduced Categories

Posted: Mon Sep 23, 2002 3:19 pm
by DoubleDoom
tuck wrote: I was thinking if there can be a conflict between hierarchies and Reduced categories (by moonbase http://www.phpbb.kicks-ass.net/forum/index.php)


I dont think you should have a conflict. Use the following instead.

Code: Select all



$template->assign_block_vars('catrow', array( 
            'CAT_ID' => $cat_id, 
            'CAT_DESC' => $category_rows[$i]['cat_title'], 
            'CAT_REDUCED_IMG' => $cat_reduced_img, 
            'U_CAT_REDUCED' => $cat_reduced_url, 
            'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id")) 
         );
and the second post, you are correct. That is a bit of leftover 2.0.0 code that wasnt updated.

I have uploaded revised instructions will alter the code for functions_admin.php.

The instructions are now complete.

functions_admin.php

Posted: Mon Sep 23, 2002 5:18 pm
by tuck
The part I was refering is this:
you wrote:

Code: Select all

$sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total 
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE  . " t 
WHERE p.forum_id = $id 
AND t.topic_id = p.topic_id 
AND t.topic_status <> " . TOPIC_MOVED;
While I have:

Code: Select all

$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total 
FROM " . POSTS_TABLE . "  
WHERE forum_id = $id";
As you can see, I don't have in my code this:
p, " . TOPICS_TABLE . " t
and this:
AND t.topic_id = p.topic_id
AND t.topic_status <> " . TOPIC_MOVED;

Posted: Mon Sep 23, 2002 5:20 pm
by DoubleDoom
New version of the mod 0.9.42 now uploaded.

Differences:

functions_admin.php has had changes in the first two bits of code to reflect 2.0.2 coding. (copy and paste the new code over the old code. Easy to identify as it is dated).

Completed missing instructions for many of the .tpl files.

In the meanwhile

Posted: Mon Sep 23, 2002 6:47 pm
by tuck
I sent you in PM the code changes for admin_forums.php

See you later

ARGHHH!

Posted: Mon Sep 23, 2002 9:37 pm
by tuck
OK, here are the prooblems, on admin panel:

Code: Select all

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /usr/local/psa/home/vhosts/mysite.net/httpdocs/phpBB2/includes/functions_admin.php on line 131
My line 131 is this:
$total_topics = ( $row = $db->sql_fetchrow($result) ) ? ( ( $row['total'] ) ? $row['total'] : 0 ) : 0;



On index

Code: Select all

Could not query categories list

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near 'FROM phpbb_categories c WHERE c.cat_hier_level = 0 AND c.parent_forum_i' at line 4

SELECT c.cat_id, c.cat_title, c.cat_order FROM phpbb_categories c FROM phpbb_categories c WHERE c.cat_hier_level = 0 AND c.parent_forum_id = 0 ORDER BY c.cat_order

Line : 148
File : /usr/local/psa/home/vhosts/mysite.net/httpdocs/phpBB2/index.php

Wait!

Posted: Mon Sep 23, 2002 9:41 pm
by tuck
Instead of:

Code: Select all

#-----[ FIND ]------------------------------------------ 
# 

$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
	FROM " . CATEGORIES_TABLE . " c 
	ORDER BY c.cat_order";

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

// DJ-Begin, 21.3.02
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
	FROM " . CATEGORIES_TABLE . " c 
    WHERE c.cat_hier_level = " . $hierarchie_level . "
    AND c.parent_forum_id = " . $parent_forum . "
	ORDER BY c.cat_order";
// DJ-End
I used what you wrote just after:

Code: Select all

# 
#-----[ OR ]------------------------------------------ 
# 
# if you want to use the hierarchy mod with the favorites mod
#

// mp+dj-begin 26.03.02
if( isset($HTTP_GET_VARS['fav']) )
{
	$userdata['user_usefavorites'] = ( $HTTP_GET_VARS['fav'] ) ? TRUE : 0;
}

$sql = "SELECT c.cat_id, c.cat_title, c.cat_order ";
if( $userdata['user_id'] == ANONYMOUS || !$userdata['user_usefavorites'] || $hierarchie_level != 0 )
{
	$sql .= "FROM " . CATEGORIES_TABLE . " c 
		WHERE c.cat_hier_level = " . $hierarchie_level . "
		AND c.parent_forum_id = " . $parent_forum;
}
else
{
	$sql .= "FROM " . USER_FAVORITES_TABLE . " uf, " . CATEGORIES_TABLE . " c 
		WHERE uf.cat_id = c.cat_id 
			AND " . $userdata['user_id'] . " = uf.user_id ";
}
$sql .= " ORDER BY c.cat_order";
// mp+dj-end
Index is showing fine now, but I still have that parse error on admin Panel, can you help me please?

Attachments

Posted: Mon Sep 23, 2002 9:48 pm
by tuck
I have Attachments mode installed, clicking on admin Panel "Shadow Attachments", I have this:

Code: Select all

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /usr/local/psa/home/vhosts/mysite.net/httpdocs/phpBB2/includes/functions_admin.php on line 131

Fatal error: Call to undefined function: sync() in /usr/local/psa/home/vhosts/mysite.net/httpdocs/phpBB2/admin/admin_attachments.php on line 571
The line 571 of this last file:

Code: Select all

sync('all topics');