[DISC] Improved pseudo sub-forums MOD 1.0.6

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
User avatar
Merri
Registered User
Posts: 255
Joined: Mon Nov 25, 2002 1:08 pm
Location: Riihimäki, Finland
Contact:

Post by Merri »

Well, atleast the page generation time is slower, because:

- category loop [go through all categories]
- process catrow template
-- forum loop [go through all forums checking if in current category]
--- attached forum loop [go through all forums checking if attached]
---- ...
--- process forumrow template


I'll optimize my own index this way:

- forum loop [go through all forums]
-- make a presorted forum array (includes add ups for postcounts etc.)
-- ...

- presorted forum loop [go through all main level forums]
-- process catrow template if category changes
-- process forumrow template
-- attached forum loop [go through all presorted attached forums]
--- process attachrow template (I have a customized template)

I expect this to reduce the processing time as there is no need for any unnecessary check.
niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

reddog wrote: Little contribution, how to add a separator if a forum
Small idea, to add the name of the parent forum in the navigation links (at the top of the page) when we are in a subforum (example):

phpBB Forum Index -> Parent Forum -> Subforum


Thanks for your contribution.

Here is a code for the feature you and others requested (navigation link to parent on childs forum):

in viewforum.php

find:

Code: Select all

make_jumpbox('viewforum.'.$phpEx);
before add

Code: Select all

if ($forum_row[attached_forum_id]>0)
{
	$parent_lookup=$forum_row[attached_forum_id];
}
in functions.php

find:

Code: Select all

function make_jumpbox($action, $match_forum_id = 0)
{
After add

Code: Select all

	global $parent_lookup;
find:

Code: Select all

					if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
					{
after add

Code: Select all

						if ($parent_lookup==$forum_rows[$j]['forum_id'])
						{
							$template->assign_block_vars('switch_parent_link', array() );

							$template->assign_vars(array(
								'PARENT_NAME' => $forum_rows[$j]['forum_name'],
								'PARENT_URL'=>append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id'])
								));
						}

Open viewforum_body.tpl

Find:

Code: Select all

<a href="{U_INDEX}" class="nav">{L_INDEX}</a>

After add (2 times - on top nav bar and on the bottom nav bar separately)

Code: Select all

	  <!-- BEGIN switch_parent_link -->
	   -> <a class="nav" href="{PARENT_URL}">{PARENT_NAME}</a>
	  <!-- END switch_parent_link -->
soulcreeper
Registered User
Posts: 28
Joined: Wed Apr 06, 2005 8:08 am
Location: Breda, NL
Contact:

Post by soulcreeper »

niekas wrote: Here is a code for the feature you and others requested (navigation link to parent on childs forum):

in viewforum.php

find:

Code: Select all

make_jumpbox('viewforum.'.$phpEx);
before add

Code: Select all

if ($forum_row[attached_forum_id]>0)
{
	$parent_lookup=$forum_row[attached_forum_id];
}
in functions.php

find:

Code: Select all

function make_jumpbox($action, $match_forum_id = 0)
{
After add

Code: Select all

	global $parent_lookup;
find:

Code: Select all

					if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
					{
after add

Code: Select all

						if ($parent_lookup==$forum_rows[$j]['forum_id'])
						{
							$template->assign_block_vars('switch_parent_link', array() );

							$template->assign_vars(array(
								'PARENT_NAME' => $forum_rows[$j]['forum_name'],
								'PARENT_URL'=>append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id'])
								));
						}

Open viewforum_body.tpl

Find:

Code: Select all

<a href="{U_INDEX}" class="nav">{L_INDEX}</a>

After add (2 times - on top nav bar and on the bottom nav bar separately)

Code: Select all

	  <!-- BEGIN switch_parent_link -->
	   -> <a class="nav" href="{PARENT_URL}">{PARENT_NAME}</a>
	  <!-- END switch_parent_link -->


why doesnt this code work on my forum?

http://forum.soulcreeper.net/viewforum.php?f=18
in this forum the parent doesnt show up. "vakantie in mexico" is a subforum.
I'm just good at being the best ®
reddog
Registered User
Posts: 32
Joined: Wed Jul 21, 2004 3:51 pm
Location: France ^^
Contact:

Post by reddog »

Thanks, I had coded it me even, but by adding a SQL query. I had not thought of the make_jumpbox function ;).
Last edited by reddog on Wed May 04, 2005 7:34 pm, edited 1 time in total.
User avatar
Merri
Registered User
Posts: 255
Joined: Mon Nov 25, 2002 1:08 pm
Location: Riihimäki, Finland
Contact:

Post by Merri »

niekas: You forgot viewtopic.php and posting.php :)
niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

Merri wrote: niekas: You forgot viewtopic.php and posting.php :)


:oops:

Yeh... But you get the idea.

I wish phpbb had separate template for navigation bar similar to jumpbox template.

soulcreeper,

not sure - check the code.

For viewtopic.php

find

Code: Select all

" . $count_sql . "
before add:

Code: Select all

, f.attached_forum_id
find

Code: Select all

make_jumpbox('viewforum.'.$phpEx, $forum_id);

Before add:

Code: Select all

if (intval($forum_topic_data['attached_forum_id'])>0)
{
	$parent_lookup=intval($forum_topic_data['attached_forum_id']);
}
Then in viewtopic_body.tpl (same like viewforum template)

Find:

Code: Select all

<a href="{U_INDEX}" class="nav">{L_INDEX}</a>


After add (2 times - on top nav bar and on the bottom nav bar separately)

Code: Select all

     <!-- BEGIN switch_parent_link -->
      -> <a class="nav" href="{PARENT_URL}">{PARENT_NAME}</a>
     <!-- END switch_parent_link --> 
Last edited by niekas on Wed May 04, 2005 7:28 pm, edited 1 time in total.
soulcreeper
Registered User
Posts: 28
Joined: Wed Apr 06, 2005 8:08 am
Location: Breda, NL
Contact:

Post by soulcreeper »

reddog wrote: Thanks, I had coded it me even, but by adding a SQL query. I had not thought of the make_jumpbox function ;).

EDIT: in functions.php, it would be rather

Code: Select all

                  if ($parent_lookup==$forum_rows[$j]['forum_id'])
                  {
                     $template->assign_block_vars('switch_parent_link', array(
                        'PARENT_NAME' => $forum_rows[$j]['forum_name'],
                        'PARENT_URL'=>append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id'])
                        ));
                  }

instead of what should this code be?

i am just a n00b in php coding, so please explain carefully :oops:
I'm just good at being the best ®
reddog
Registered User
Posts: 32
Joined: Wed Jul 21, 2004 3:51 pm
Location: France ^^
Contact:

Post by reddog »

@soulcreeper: oups, don't use my code in EDIT, just use that given by niekas.
reddog
Registered User
Posts: 32
Joined: Wed Jul 21, 2004 3:51 pm
Location: France ^^
Contact:

Post by reddog »

Another idea. I did it for my board, but the idea can interest you niekas. You can modify the jumpbox to have:

|-Category
|
|---Parent Forum
|------Subforum 1
|---Forum

etc... ;)
soulcreeper
Registered User
Posts: 28
Joined: Wed Apr 06, 2005 8:08 am
Location: Breda, NL
Contact:

Post by soulcreeper »

correct me when i'm wrong. nut wasn't it the idea to put it like this:

index >> viewforum 1 >> viewforum 2 (subforum)

in that way, that when you are viewing the subforum, the name of the forum where te subforum is attached to, is still in that line?

cause at my forum it's like this now:
SoulCreeper.net Forum Index » Vakantie in Mexico

when it should be like this:
SoulCreeper.net Forum Index » Kinderspeelplaats » Vakantie in Mexico
(where Vakantie in Mexico is the subforum of Kinderspeelplaats)
I'm just good at being the best ®
reddog
Registered User
Posts: 32
Joined: Wed Jul 21, 2004 3:51 pm
Location: France ^^
Contact:

Post by reddog »

the result gives this if you use the code given by niekas:

Forum Index -> Parent Forum -> Subforum

like this if you are in the Subforum attached to Parent Forum.
soulcreeper
Registered User
Posts: 28
Joined: Wed Apr 06, 2005 8:08 am
Location: Breda, NL
Contact:

Post by soulcreeper »

reddog wrote: the result gives this if you use the code given by niekas:

Forum Index -> Parent Forum -> Subforum

like this if you are in the Subforum attached to Parent Forum.

why doesnt it show up like that at my forum?
i exactly copied the codes from niekas into my files.
I'm just good at being the best ®
reddog
Registered User
Posts: 32
Joined: Wed Jul 21, 2004 3:51 pm
Location: France ^^
Contact:

Post by reddog »

Here how I made on my board:

Code: Select all

#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx);
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
if ($forum_row['attached_forum_id'] > 0)
{
	$parent_lookup = $forum_row['attached_forum_id'];
}
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------------
#
function make_jumpbox($action, $match_forum_id = 0)
{ 
#
#-----[ AFTER, ADD ]------------------------------------------
#
	global $parent_lookup;
#
#-----[ FIND ]------------------------------------------------
#
					if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
					{
#
#-----[ AFTER, ADD ]------------------------------------------
#
						if ($parent_lookup == $forum_rows[$j]['forum_id'])
						{
							$template->assign_block_vars('nav', array(
								'L_NAV' => $forum_rows[$j]['forum_name'],
								'U_NAV'=> append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id'])
							));
						}
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/viewforum_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
# or similar line
#
</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE FIND ]----------------------------------------
#
</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
</a>
#
#-----[ AFTER, ADD ]------------------------------------------
#
# on a new line
#
	  	<!-- BEGIN nav -->
	  	&raquo;&nbsp;<a href="{nav.U_NAV}" class="nav">{nav.L_NAV}</a>
	  	<!-- END nav -->
	  	&raquo;&nbsp;<a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a>
	</span></td>
The actions in viewforum_body.tpl are to be made twice (top and bottom navigation links). That functions for me.
soulcreeper
Registered User
Posts: 28
Joined: Wed Apr 06, 2005 8:08 am
Location: Breda, NL
Contact:

Post by soulcreeper »

allright, i've got it working now. but just one final question:
how can i make the title run through to the edge of my board? i placed the "mark all topics read" a row above. in the same row as the pagination.
I'm just good at being the best ®
Mehrpack
Registered User
Posts: 4
Joined: Sun May 01, 2005 1:48 pm

Post by Mehrpack »

niekas wrote: It already displays big folder image:



hi,
ah, nice.

dont saw it on the feature list.

Mehrpack
Nobody is Perfect.
Locked

Return to “[2.0.x] MODs in Development”