Page 15 of 34

Posted: Wed May 04, 2005 3:57 pm
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.

Posted: Wed May 04, 2005 5:14 pm
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 -->

Posted: Wed May 04, 2005 6:35 pm
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.

Posted: Wed May 04, 2005 6:37 pm
by reddog
Thanks, I had coded it me even, but by adding a SQL query. I had not thought of the make_jumpbox function ;).

Posted: Wed May 04, 2005 6:51 pm
by Merri
niekas: You forgot viewtopic.php and posting.php :)

Posted: Wed May 04, 2005 7:00 pm
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 --> 

Posted: Wed May 04, 2005 7:24 pm
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:

Posted: Wed May 04, 2005 7:36 pm
by reddog
@soulcreeper: oups, don't use my code in EDIT, just use that given by niekas.

Posted: Wed May 04, 2005 7:44 pm
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... ;)

Posted: Wed May 04, 2005 7:55 pm
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)

Posted: Wed May 04, 2005 9:22 pm
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.

Posted: Wed May 04, 2005 9:26 pm
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.

Posted: Wed May 04, 2005 9:54 pm
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.

Posted: Thu May 05, 2005 12:50 am
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.

Posted: Thu May 05, 2005 2:23 am
by Mehrpack
niekas wrote: It already displays big folder image:



hi,
ah, nice.

dont saw it on the feature list.

Mehrpack