How to add custom code to spesific forum or subforum page ?

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
Bymemor
Registered User
Posts: 154
Joined: Sun Dec 01, 2019 7:55 pm

How to add custom code to spesific forum or subforum page ?

Post by Bymemor »

I have ads banner codes. But because this is educational ad banner, I only add this banner code to the page of a specific forum.

For example, I have education forum and off topic forum. I want to add this code and happen all changes on education forum.

How could I achieve that ? Maybe this can be handled with forum id or another smt. but I am not sure.
User avatar
Mannix_
Registered User
Posts: 2003
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

Re: How to add custom code to spesific forum or subforum page ?

Post by Mannix_ »

Wrap your code inside if statement f.e

Code: Select all

<!-- IF S_FORUM_ID == '5' -->
	Your code
<!-- ENDIF -->
change 5 to whatever your forum id is you want the code to show up
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
Bymemor
Registered User
Posts: 154
Joined: Sun Dec 01, 2019 7:55 pm

Re: How to add custom code to spesific forum or subforum page ?

Post by Bymemor »

Thank you
User avatar
Bymemor
Registered User
Posts: 154
Joined: Sun Dec 01, 2019 7:55 pm

Re: How to add custom code to spesific forum or subforum page ?

Post by Bymemor »

Mannix_ wrote: Fri May 08, 2020 9:31 am Wrap your code inside if statement f.e
But to what php file should I add this code ? overall_header.html ?
User avatar
Mannix_
Registered User
Posts: 2003
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

Re: How to add custom code to spesific forum or subforum page ?

Post by Mannix_ »

Bymemor wrote: Tue May 26, 2020 12:33 pm
Mannix_ wrote: Fri May 08, 2020 9:31 am Wrap your code inside if statement f.e
But to what php file should I add this code ? overall_header.html ?
How should I know where your code is placed? Just find it and wrap in the statement i provided
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
Bymemor
Registered User
Posts: 154
Joined: Sun Dec 01, 2019 7:55 pm

Re: How to add custom code to spesific forum or subforum page ?

Post by Bymemor »

Mannix_ wrote: Tue May 26, 2020 1:52 pm How should I know where your code is placed?
Nowhere, that is the case. I want to place my code now to exact subforum. So, should I add into viewforum_body.html or somewher else and if I wrap code where will it be shown up in specific forum page ? (I mean top, bottom or anywhere else)
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: How to add custom code to spesific forum or subforum page ?

Post by Lumpy Burgertushie »

probably in viewforum_body.html

try opening that file in your text editor and just type the word "hello" somewhere on the page.
save the file, upload back to the server and purge the cache to see the change. based on where the word hello appears on the page you can then go back and adjust until you get the word hello right where you want the banner to show up.

now, find the forum ID number of your education forum. ( hover over the forum title and look at the status bar
at the bottom of the page and it will show you the forum ID number ).
now, back in the viewforum_body.html file. find the spot you decided on for the banner and type this:

Code: Select all

<!-- IF S_FORUM_ID == '5' -->
	Your html/css for the banner you want
<!-- ENDIF -->
changing the 5 to whatever your forum ID is.

save the file, upload , purge, check.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
Bymemor
Registered User
Posts: 154
Joined: Sun Dec 01, 2019 7:55 pm

Re: How to add custom code to spesific forum or subforum page ?

Post by Bymemor »

Lumpy Burgertushie wrote: Wed May 27, 2020 12:13 am save the file, upload , purge, check.
Thanks, Lumpy you cleared everything for me.

Return to “phpBB Custom Coding”