Removing elements using extensions

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
Miigii
Registered User
Posts: 4
Joined: Thu Mar 14, 2019 8:00 am

Removing elements using extensions

Post by Miigii » Tue Mar 26, 2019 10:36 am

If I want to remove some elements from prosilver is there any way I could do it by using extensions? One way is of course to just hide the elements by using css but I'd like that the elements wouldn't render at all. I know I could just edit the core templates but I'd like to have core code as it is and do modifications in extensions.

User avatar
mrgoldy
Jr. Extension Validator
Posts: 1159
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: Removing elements using extensions

Post by mrgoldy » Tue Mar 26, 2019 10:52 am

Without specifying which parts you exactly want to hide, it is impossible to tell.
It might be possible to set an {% if %} statement to false, so it will not get rendered.

But in general, it is not possible to not render a specific part in prosilver.
You can indeed use css to set display: none; or use jQuery to $(selector).hide().

I believe there should be more possibilities once the new theme comes out, Chameleon, but that will be a while.

Another possibility is to route the user to a completely different template file from within your extension, and copy and adjust the core template file.
But that will cause for it to me high maintenance, as for each new phpBB version you will have to check for changes in that specific template file(s) and add them yourself. Which pretty much comes down to making core changes.

Miigii
Registered User
Posts: 4
Joined: Thu Mar 14, 2019 8:00 am

Re: Removing elements using extensions

Post by Miigii » Tue Mar 26, 2019 11:17 am

Thanks for the answer. What I've done is wrapping elements inside if blocks that always return false like:

Code: Select all

<!-- IF HIDE_FEATURE -->
<!-- ENDIF -->
This also causes a lot of maintenance but this way at least I can grep my files that contains text 'HIDE_FEATURE'. Let's hope that in the future doing this will be easier.

User avatar
david63
Registered User
Posts: 16535
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Removing elements using extensions

Post by david63 » Tue Mar 26, 2019 12:48 pm

You cannot use if/end if in two events in the current version but I believe that it should be possible in 3.3
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
mrgoldy
Jr. Extension Validator
Posts: 1159
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: Removing elements using extensions

Post by mrgoldy » Tue Mar 26, 2019 2:56 pm

I think he's modifyin core files, so then it should be possible.
That does however mean this became Custom coding, rather than a Extension writing discussion.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66727
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Removing elements using extensions

Post by Lumpy Burgertushie » Tue Mar 26, 2019 6:28 pm

and probably the best way to do what he wants is to just create a custom style based on prosilver.

then use that style and update it manually when needed.


roberty
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
3Di
Former Team Member
Posts: 14220
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Removing elements using extensions

Post by 3Di » Sun Mar 31, 2019 12:39 pm

Perhaps the OP wants parts of code not be rendered in the "view source" side of things?
Miigii wrote:
Tue Mar 26, 2019 10:36 am
One way is of course to just hide the elements by using css but I'd like that the elements wouldn't render at all.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

Post Reply

Return to “phpBB Custom Coding”