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 »

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
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: Removing elements using extensions

Post by mrgoldy »

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.
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
Miigii
Registered User
Posts: 4
Joined: Thu Mar 14, 2019 8:00 am

Re: Removing elements using extensions

Post by Miigii »

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: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Removing elements using extensions

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: Removing elements using extensions

Post by mrgoldy »

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.
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Removing elements using extensions

Post by Lumpy Burgertushie »

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
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
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Removing elements using extensions

Post by 3Di »

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.
🆓 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
Post Reply

Return to “phpBB Custom Coding”