Only index, forum and topic

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
Post Reply
User avatar
halil16
Registered User
Posts: 1280
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Only index, forum and topic

Post by halil16 »

I have added a welcome and input field at the end of the navbar file. However, I want this to appear only on index, forum and topic pages.

I tried to do something like the following but it didn't work:

<!-- IF SCRIPT_NAME eq 'index' or 'viewforum' or 'viewtopic' -->

Can you help me?
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
User avatar
Mannix_
Registered User
Posts: 1857
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt
Contact:

Re: Only index, forum and topic

Post by Mannix_ »

halil16 wrote: Sat Apr 17, 2021 12:06 pm
Can you help me?
It should be

Code: Select all

<!-- IF SCRIPT_NAME eq 'index' or SCRIPT_NAME eq 'viewforum' or SCRIPT_NAME eq 'viewtopic' -->
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
halil16
Registered User
Posts: 1280
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Re: Only index, forum and topic

Post by halil16 »

I couldn't think of that. :)
Yes it's okay. Thank you so much.

Best regards.
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Only index, forum and topic

Post by 3Di »

halil16 wrote: Sat Apr 17, 2021 12:06 pm I have added a welcome and input field at the end of the navbar file. However, I want this to appear only on index, forum and topic pages.

I tried to do something like the following but it didn't work:

<!-- IF SCRIPT_NAME eq 'index' or 'viewforum' or 'viewtopic' -->

Can you help me?
Not tested but I think you can use TWIG

Code: Select all

{% if SCRIPT_NAME in ['index', 'viewforum', 'viewtopic'] %}
    do your stuff here
{% endif %}
Which is the same of using in_array() in PHP.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
halil16
Registered User
Posts: 1280
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Re: Only index, forum and topic

Post by halil16 »

Thank you. So, is it possible to hide it from certain usergroups?

By the method in my first message or by code you provided.
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Only index, forum and topic

Post by 3Di »

Not sure about which groups?
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
halil16
Registered User
Posts: 1280
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Re: Only index, forum and topic

Post by halil16 »

Sorry. I could not express it well.
Actually, the last question I asked is independent of this issue. But there is the same goal.

The code below is used to show on various pages.
<!-- IF SCRIPT_NAME eq 'index' or 'viewforum' or 'viewtopic' -->

Is it possible to hide content from various groups with the same logic?
For example from Managers, Moderators or VIP members.

The official Advertisement extension can do this, for example. But I don't know with what codes.
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Only index, forum and topic

Post by 3Di »

You can hide it for certain basic groups like registered, bots, guests using the basic variables provided by the main code, yes.

To hide it for certain user-defined groups then you need an extension or someone to tell you how to do it, I don't like hard-coding things so if you don't mind I'll give up, not because I can't do it but because I don't want to. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Only index, forum and topic

Post by 3Di »

Example, this should show your stuff only to guests. (Not tested).

Code: Select all

{% if SCRIPT_NAME in ['index', 'viewforum', 'viewtopic'] and not S_USER_LOGGED_IN %}
    do your stuff here
{% endif %}
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Mannix_
Registered User
Posts: 1857
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt
Contact:

Re: Only index, forum and topic

Post by Mannix_ »

3Di wrote: Sat Apr 17, 2021 11:43 pm
Not tested but I think you can use TWIG

Code: Select all

{% if SCRIPT_NAME in ['index', 'viewforum', 'viewtopic'] %}
    do your stuff here
{% endif %}
Which is the same of using in_array() in PHP.
Just tested and it works. Thanks Marco :D
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
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Only index, forum and topic

Post by 3Di »

Mannix_ wrote: Sun Apr 18, 2021 7:33 am Just tested and it works. Thanks Marco :D
Thanks for the test, it confirms that my brain still works. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
halil16
Registered User
Posts: 1280
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil
Contact:

Re: Only index, forum and topic

Post by halil16 »

Thank you for your help.
* Hire me at fiverr for your phpBB board.
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
I'm learning English...
Contributions: #Hashtag, Elegance, Latte
Post Reply

Return to “phpBB Custom Coding”