Conditionals/Forums on every pages ?

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Show forums on each and every pages

Post by ZYVHK »

RMcGirr83 wrote:
Tue Nov 10, 2020 12:17 pm
ZYVHK wrote:
Tue Nov 10, 2020 12:41 am
What I would like to do is some kind of always-visible forums navigation that would allow users to see every forums they have access to and see the lastposts, forums descriptions, messages number and everything on any page.
viewforum, viewtopic, posting, memberlist, viewonline, user control panel, faq, etc? No offense but personally that would drive me completely insane.
To tell you everything, it would be a sidebar navigation on the left, like what you can see on some modern community boards.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52169
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Conditionals/Forums on every pages ?

Post by Brf »

Indeed.
You already have the Jumpbox at the bottom of every page, except the Index. Is that not enough?
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Conditionals/Forums on every pages ?

Post by ZYVHK »

Itsn't. It would become the main forums navigation, so having no other information than the forum name (and its link) would be awkward.
User avatar
Mannix_
Registered User
Posts: 961
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt
Contact:

Re: Conditionals/Forums on every pages ?

Post by Mannix_ »

ZYVHK wrote:
Tue Nov 10, 2020 3:45 pm
Itsn't. It would become the main forums navigation, so having no other information than the forum name (and its link) would be awkward.
That's your opinion. Navigation doesn't need more then a name and a link. Did you thought how it would look like on smaller screens / mobiles? IMHO not user friendly.

Similar question was asked here viewtopic.php?f=641&t=2569216&p=15598081#p15598081
I would say that is enough when it comes to navigation but that is my opinion 😋
-=-=-=-=-=-=-=-=-=-=-=-=-My Styles-=-=-=-=-=-=-=-=-=-=-=-=-
HexagonHexagonRebornCleanSilverProject Durango
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Need help with styling or want me to port a style to 3.3.x etc. contact me here or here.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Conditionals/Forums on every pages ?

Post by ZYVHK »

Mannix_ wrote:
Tue Nov 10, 2020 7:10 pm
ZYVHK wrote:
Tue Nov 10, 2020 3:45 pm
Itsn't. It would become the main forums navigation, so having no other information than the forum name (and its link) would be awkward.
Did you thought how it would look like on smaller screens / mobiles? IMHO not user friendly.
I made this kind of navigation on an older project and gave users the choice between having a permanent navigation like we're talking about and the classic one. Users with screens that aren't large enough were forced to use the classic one.
As you said, I'm more about having more informations when navigating, but that's obviously my opinion.

I visited your link; after thinking about it, it could be an alternative to have this permanent quick jump and every information on the index (classic view) at the same time. If my 'request' isn't doable or if nobody has the time/motivation to achieve it (which I would entirely understand), I'd go for that. :)
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4253
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Conditionals/Forums on every pages ?

Post by thecoalman »

ZYVHK wrote:
Tue Nov 10, 2020 3:45 pm
Itsn't. It would become the main forums navigation, so having no other information than the forum name (and its link) would be awkward.
I can set you off in right direction... If you open includes/functions_content.php around line 161 for the jumpbox:

Code: Select all

	$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
Add the columns you want from forums table, e.g. forum_desc

Code: Select all

	$sql = 'SELECT forum_id, forum_name, forum_desc, parent_id, forum_type, left_id, right_id
Down a little bit find the template array:

Code: Select all

		$tpl_ary[] = array(
			'FORUM_ID'		=> $row['forum_id'],
			'FORUM_NAME'	=> $row['forum_name'],
			'SELECTED'		=> ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '',
			'S_FORUM_COUNT'	=> $iteration,
			'S_IS_CAT'		=> ($row['forum_type'] == FORUM_CAT) ? true : false,
			'S_IS_LINK'		=> ($row['forum_type'] == FORUM_LINK) ? true : false,
			'S_IS_POST'		=> ($row['forum_type'] == FORUM_POST) ? true : false,
			'LINK'			=> $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])),
		);
Add the description:

Code: Select all

		$tpl_ary[] = array(
			'FORUM_ID'		=> $row['forum_id'],
			'FORUM_NAME'	=> $row['forum_name'],
			'FORUM_DESC'	=> $row['forum_desc'],
			'SELECTED'		=> ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '',
			'S_FORUM_COUNT'	=> $iteration,
			'S_IS_CAT'		=> ($row['forum_type'] == FORUM_CAT) ? true : false,
			'S_IS_LINK'		=> ($row['forum_type'] == FORUM_LINK) ? true : false,
			'S_IS_POST'		=> ($row['forum_type'] == FORUM_POST) ? true : false,
			'LINK'			=> $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])),
		);

{FORUM_DESC}
would be placeholderfor for forum description but one issue I see already is it's formatted text and I'm not sure what function is used to parse it.

Make a copy of template jumbox.html and name it my_navigation.html or whatever you want. You would use that as guide to construct the html you need. You can then include your template in overall_header.html. In your template you are going to do something like:

Code: Select all

<div class="my-navigation">

	<!-- BEGIN jumpbox_forums -->
	//your custom html
	<!-- END jumpbox_forums -->

</div>
As I said it will set you in right direction, there is some work to get this right.

As far as the mobile screens go it can be hidden using responsive classes already available.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Conditionals/Forums on every pages ?

Post by ZYVHK »

Hey,
Thanks a lot for your reply and explanations thecoalman.

I'm not sure I understood it all and apologize in advance if it should be obvious:
What I did is create a new template (forum_navigation.html that I included in the overall_header template.

Should the following code work or did I get it wrong?:

Code: Select all

<div class="my-navigation">
<!-- BEGIN jumpbox_forums -->
{FORUM_DESC}
<!-- END jumpbox_forums -->
</div>
as nothing appears.
Thanks again.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4253
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Conditionals/Forums on every pages ?

Post by thecoalman »

Try purging the cache, anytime you edit templates or php files always purge the cache.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Conditionals/Forums on every pages ?

Post by ZYVHK »

This is what shows up:

Code: Select all

<div class="my-navigation">
Your first forum - Description of your first forum.<br>
Your first forum - Description of your first forum.<br>
Your first forum - Description of your first forum.<br>
Your first forum - Description of your first forum.<br>
Your first forum - Description of your first forum.<br>
</div>
Going in another random subforum would also show the forum name & description about 5 times.
On a random page such as the UCP, nothing shows up. :/
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4253
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Conditionals/Forums on every pages ?

Post by thecoalman »

I said I could point you in the right direction, this is going to require a little work and I don't have time to write it all.

You need to duplicate the jumpbox template code accept the HTML.

Code: Select all

				<!-- BEGIN jumpbox_forums -->
				<!-- IF jumpbox_forums.FORUM_ID neq -1 -->
				<li><a href="{jumpbox_forums.LINK}" class="<!-- IF jumpbox_forums.level -->jumpbox-sub-link<!-- ELSEIF jumpbox_forums.S_IS_CAT -->jumpbox-cat-link<!-- ELSE -->jumpbox-forum-link<!-- ENDIF -->"><!-- BEGIN level --><span class="spacer"></span><!-- END level --> <span><!-- IF jumpbox_forums.level --><!-- IF S_CONTENT_DIRECTION eq 'rtl' -->&#8626;<!-- ELSE -->&#8627;<!-- ENDIF --> &nbsp;<!-- ENDIF --> {jumpbox_forums.FORUM_NAME}</span></a></li>
				<!-- ENDIF -->
				<!-- END jumpbox_forums -->
As far as it not showing up on every page you'll need to see how that function is called from other pages and do it on ones it is not.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Conditionals/Forums on every pages ?

Post by ZYVHK »

Okay, I understand how it works now. Thanks a lot for your time.
I have one last question: the forum_last_post_time shows up as plain/raw text (1604937523), I was wondering how I could format it correctly?

Thank you.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4253
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Conditionals/Forums on every pages ?

Post by thecoalman »

ZYVHK wrote:
Thu Nov 12, 2020 4:36 pm
I have one last question: the forum_last_post_time shows up as plain/raw text (1604937523), I was wondering how I could format it correctly?
The best way to learn is look at what other people do. If you have decent text editor like Notepad++ you can search all documents in a directory. Search for forum_last_post_time in the phpBB directory, make sure search subfolders is checked.

To answer your question that is Unix time stamp. It's how many seconds have elapsed since Jan 1, 1970. There is php function to convert to readable form.

https://www.php.net/manual/en/datetime.settimestamp.php
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
ZYVHK
Registered User
Posts: 48
Joined: Sat Jul 15, 2017 1:38 am
Location: France
Name: Lucas

Re: Conditionals/Forums on every pages ?

Post by ZYVHK »

Hey,
Sorry for not replying earlier.

Thanks again thecoalman. I'm not sure how I can convert it, like I don't know at all how and where (i.e in which file, as I don't know templates can read php?) I'm supposed to do it ?
Post Reply

Return to “phpBB Custom Coding”