Style skeleton for prosilver

For support and discussion related to templates and themes in phpBB 3.3.
User avatar
cabot
Jr. Style Validator
Posts: 1026
Joined: Sat Jan 07, 2012 4:16 pm

Re: Style skeleton for prosilver

Post by cabot »

Imho, it's not really intended for style designers who have the necessary knowledge to find their way around the files, but possibly for an admin who would like to change a few colours or the logo and not have to worry about the style for future updates. ^^
User avatar
consros
Registered User
Posts: 13
Joined: Sat Mar 08, 2025 7:53 pm

Re: Style skeleton for prosilver

Post by consros »

cabot wrote: Sun Mar 09, 2025 3:33 pm
    • |__ theme/
      • |__ stylesheet.css

        Code: Select all

        @import url("../../prosilver/theme/stylesheet.css");
        
        /* Below are your custom CSS rules */
        .foo {
        	color: #fff;
        }
Is there also a similar mechanics for the templates exists?
    • |__ template/
      • |__ overall_header.html

        Code: Select all

        <!-- INCLUDE ../../prosilver/template/overall_header.html -->
        
        <h1>My addition to common header</h1>
--> HTTP 500

And it works if the referenced file is located in the same directory:

Code: Select all

<!-- INCLUDE overall_header_impl.html -->

<h1>My addition to common header</h1>
User avatar
cabot
Jr. Style Validator
Posts: 1026
Joined: Sat Jan 07, 2012 4:16 pm

Re: Style skeleton for prosilver

Post by cabot »

You cannot include the overall_header.html in another overall_header.html, it makes no sense.
If you want to modify this file, make a copy in your own style and modify it.

Furthermore, when you call a template file as an include, phpBB will first look for it in the current style. If it doesn't find it, it will go back into the parent styles until it finds the corresponding file.
Everything is explained in the documentation. ;)
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6692
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Style skeleton for prosilver

Post by thecoalman »

Note the HTML comment like syntax is phpBB's custom template engine syntax which is being replaced by Twig syntax. You can still use either but I would use Twig for future proofing.

I poked around a little in the Twig documentation and doesn't appear to be anyway to do what you want to do with same filename because the root filepath is set as Cabot mentioned. Twig doesn't recognize the ../ and you just use the file or path like this:

Code: Select all

{% include 'prosilver/template/overall_header.html' %}
This gives error(prosilver2/ is test child style):

Code: Select all

 Unable to find template "prosilver/template/overall_header.html" (looked into: C:\xampp\htdocs\test\styles\prosilver2\template, C:\xampp\htdocs\test\styles\prosilver2\theme, C:\xampp\htdocs\test\styles\prosilver\template, C:\xampp\htdocs\test\styles\prosilver\theme, C:\xampp\htdocs\test\styles\all\template) in "overall_header.html"
Presumably it's looking in the various directories with prosilver/template/overall_header.html appended. If there is anyway to do this it will be found in Twig documentation. Otherwise copying overall_header.html and renaming it like you already did appears to be one way to do it.

cabot wrote: Mon Mar 10, 2025 6:39 pm You cannot include the overall_header.html in another overall_header.html, it makes no sense.
It makes perfect sense if you just want to just append or prepend some HTML to original template. It's because of things like this I prefer to just edit Prosilver for my own customized style. I'm not publishing it so there really isn't any benefit to using child style.
“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
consros
Registered User
Posts: 13
Joined: Sat Mar 08, 2025 7:53 pm

Re: Style skeleton for prosilver

Post by consros »

Thanks to both of you for helpful advices!

I appreciate the time and effort you put into sharing your knowledge!
User avatar
cabot
Jr. Style Validator
Posts: 1026
Joined: Sat Jan 07, 2012 4:16 pm

Re: Style skeleton for prosilver

Post by cabot »

@thecoalman,

When a file is included, the engine first looks for it in the current style. If it finds it, it executes it. But if that file includes itself, it creates an infinite loop, leading to a memory exhaustion error.

That's why I say it makes no sense (technically) to try to call overall_header as an include in overall_header. :)
User avatar
consros
Registered User
Posts: 13
Joined: Sat Mar 08, 2025 7:53 pm

Re: Style skeleton for prosilver

Post by consros »

If someone is interested in the result of this work, here it is.

It is a generalized style without my specific additions and could potentially be useful for many people.

For my own use, this version will receive additional changes, including modified templates, which were not necessary here.

P.S. And what's even more awesome — my own style will inherit from the applied style (Sandy) instead of modifying it.
Multilevel inheritance is supported and works — who would have thought!
You do not have the required permissions to view the files attached to this post.

Return to “[3.3.x] Styles Support & Discussion”