Cant figure out how to create style with inherit

For support and discussion related to templates, themes, and imagesets in phpBB 3.2.
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Cant figure out how to create style with inherit

Post by BigDrago »

Hi. I am trying to create my own style with inherit using parent. Is there a program for pc or mac that allows WYSIWYG editing?

When previeweing myown (I havent done any editing yet) style it looks kind of strange, it doesnt look at all like prosilver.

I have read the tutorials and all...

Styles folder:
prosilver
myown

myown has this files and directories
style.cfg (parent = prosilver)
template (empty)
theme (with stylesheet.css)
----en (with 2 images from prosilver)
----images (with all images from prosilver)
---------plupload (with 3 images from prosilver)

stylesheet.css contains this:

Code: Select all

@import url("../../prosilver/theme/base.css");
@import url("../../prosilver/theme/bidi.css");
@import url("../../prosilver/theme/buttons.css");
@import url("../../prosilver/theme/colours.css");
@import url("../../prosilver/theme/common.css");
@import url("../../prosilver/theme/content.css");
@import url("../../prosilver/theme/cp.css");
@import url("../../prosilver/theme/forms.css");
@import url("../../prosilver/theme/icons.css");
@import url("../../prosilver/theme/links.css");
@import url("../../prosilver/theme/normalize.css");
@import url("../../prosilver/theme/plupload.css");
@import url("../../prosilver/theme/print.css");
@import url("../../prosilver/theme/responsive.css");
@import url("../../prosilver/theme/tweaks.css");
@import url("../../prosilver/theme/utilities.css");
User avatar
Scanialady
Registered User
Posts: 433
Joined: Thu Jan 17, 2013 7:09 pm
Location: Germany
Name: Annette

Re: Cant figure out how to create style with inherit

Post by Scanialady »

If you want to create a child style for phpBB 3.2.x you are on the wrong way. Seems you are following a manual for outdated phpBB versions.

have a look here:

https://www.phpbb.com/styles/create/

The shortest way is: create a copy of /prosilver.
Rename the folder, change the style name in .cfg and overall_header.html and so on.
Delete all files you want to use from original prosilver, left over the files you want to change. (mostly it is enough to use the /theme folder and css files for your own changes, if you don't need template changes)
My 2 cents: Whether an extension is in the CDB says nothing about its quality. It is more important to read the support topics for it. Better to avoid authors who do not answer support questions themselves, who do not update their stuff, and who do not fix bugs for years.
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cant figure out how to create style with inherit

Post by BigDrago »

Scanialady wrote: Wed Sep 04, 2019 11:49 am If you want to create a child style for phpBB 3.2.x you are on the wrong way. Seems you are following a manual for outdated phpBB versions.

have a look here:

https://www.phpbb.com/styles/create/

The shortest way is: create a copy of /prosilver.
Rename the folder, change the style name in .cfg and overall_header.html and so on.
Delete all files you want to use from original prosilver, left over the files you want to change. (mostly it is enough to use the /theme folder and css files for your own changes, if you don't need template changes)
Thanks man. Will have a look into it👍
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Cant figure out how to create style with inherit

Post by david63 »

BigDrago wrote: Wed Sep 04, 2019 1:18 pm Thanks man.
You may want to review that if you read the username ( Scanialady )
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
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cant figure out how to create style with inherit

Post by BigDrago »

david63 wrote: Wed Sep 04, 2019 2:08 pm
BigDrago wrote: Wed Sep 04, 2019 1:18 pm Thanks man.
You may want to review that if you read the username ( Scanialady )
Damn😂 sorry ScaniaLady!
User avatar
warmweer
Jr. Extension Validator
Posts: 12005
Joined: Fri Jul 04, 2003 6:34 am
Location: somewhere in the space-time continuum

Re: Cant figure out how to create style with inherit

Post by warmweer »

david63 wrote: Wed Sep 04, 2019 2:08 pm You may want to review that if you read the username ( Scanialady )
Still doesn't prove anything in modern times ;) (not insinuating anything :roll: )
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cant figure out how to create style with inherit

Post by BigDrago »

Scanialady wrote: Wed Sep 04, 2019 11:49 am If you want to create a child style for phpBB 3.2.x you are on the wrong way. Seems you are following a manual for outdated phpBB versions.

have a look here:

https://www.phpbb.com/styles/create/

The shortest way is: create a copy of /prosilver.
Rename the folder, change the style name in .cfg and overall_header.html and so on.
Delete all files you want to use from original prosilver, left over the files you want to change. (mostly it is enough to use the /theme folder and css files for your own changes, if you don't need template changes)
That is the guide I am following.
https://www.phpbb.com/styles/create/#a- ... nheritance
Method 2. Relative-path @import with selective replacement
If you only want to make changes to a few of the parent's CSS files, you might not want to duplicate all the assets, since that would just clutter your new style. It is possible to only copy a few assets and make changes to them, without having identical copies scattered around the server. In your new style's stylesheet.css, you could include the following code:

@import url("../../prosilver/theme/common.css");
@import url("../../prosilver/theme/links.css");
@import url("../../prosilver/theme/content.css");
@import url("../../prosilver/theme/buttons.css");
@import url("../../prosilver/theme/cp.css");
@import url("../../prosilver/theme/forms.css");
@import url("colours.css");
User avatar
EA117
Registered User
Posts: 2175
Joined: Wed Aug 15, 2018 3:23 am

Re: Cant figure out how to create style with inherit

Post by EA117 »

BigDrago wrote: Wed Sep 04, 2019 10:09 pm
Method 2. Relative-path @import with selective replacement
Agreed, and we definitely expect that this approach should be successful. It's not obvious to me anyway why you're not getting the expected outcome.

But it's kind of hard to say what's wrong in the outcome you're seeing, when we can see neither what that outcome looks like, nor hit F12 to get a sense of what may be wrong at a template or CSS level. Is the site online enough that you can give a URL to the board attempting to display your style?

One other thought is to double-check that selecting "prosilver" as the style doesn't also show as broken. i.e. Some unintentional edit or drag-n-drop has damaged prosilver, which is why "your style looks broken", too.


Myself personally, I don't do exactly what Method 2 describes, but instead use the alternative method alluded to in Method 3. Which is to simply pull in "just the stylesheet.css" from prosilver, so that you get "everything prosilver would have included" as your baseline behavior. Then in addition to the imported prosilver stylesheet.css, you can create and import your own local CSS for those changes which are unique to your new style.

Meaning a minimum "should look just like prosilver" style at first could be comprised of:

/styles/myown/style.cfg (with parent=prosilver in addition to the other details)
/styles/myown/theme/stylesheet.css (containing only@import url("../../prosilver/theme/stylesheet.css");)
/styles/myown/theme/en/stylesheet.css (containing only @import url("../../../prosilver/theme/en/stylesheet.css");)
/styles/myown/theme/bidi.css (containing only @import url("../../prosilver/theme/bidi.css");)
/styles/myown/theme/plupload.css (containing only @import url("../../prosilver/theme/plupload.css");)
/styles/myown/theme/print.css (containing only @import url("../../prosilver/theme/print.css");)
/styles/myown/theme/tweaks.css (containing only @import url("../../prosilver/theme/tweaks.css");)

And nothing else.

Which method and approach "makes the best sense" kind of depends on how extensive the customization you ultimately intend to perform will be. But typically "pulling in 100% of everything that prosilver would have done, and then customize from there" gives you the best chance to automatically inherit any future changes which are delivered as phpBB updates the underlying prosilver style.

Every template file you have to copy into your style, and every CSS file you copy into your style instead of importing, is one less prosilver file for which you will automatically inherit phpBB updated changes. Which is necessary and intentional for certain types of changes; but not something you want to do accidentally or unnecessarily at the expense of increased future maintenance for your style.

Note you don't need to copy those prosilver image files, because the image paths are relative to the CSS file which is referencing them. So for example, the attempt to reference "./images/topic_read.gif" in prosilver's colours.css is not attempting to reference "/styles/myown/theme/images/topic_read.gif" just because your style imported prosilver's colours.css. The prosilver colours.css is still trying to reference "/styles/prosilver/theme/images/topic_read.gif", because that's the images directory that prosilver's colours.css file is relative to.

You will need to have your own style-specific images directory only once you have created customizations which are unique to your style, and your custom CSS needs to pull in images which are different from what prosilver was already displaying.
Last edited by EA117 on Wed Sep 04, 2019 11:12 pm, edited 1 time in total.
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cant figure out how to create style with inherit

Post by BigDrago »

Thanks. Will try it!
First I thought setting parent=prosilver would import everything that was missing.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: Cant figure out how to create style with inherit

Post by 3Di »

BigDrago wrote: Wed Sep 04, 2019 11:10 pm Thanks. Will try it!
First I thought setting parent=prosilver would import everything that was missing.
Did you already read this: https://www.phpbb.com/styles/create/ ?
🆓 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
Talk19Zehn
Registered User
Posts: 917
Joined: Tue Aug 09, 2011 1:10 pm

Re: Cant figure out how to create style with inherit

Post by Talk19Zehn »

Create a Child-Design

Hello, please see the graphical directory structure: My model style is called ownprosilver.
In addition to the *overall_header.html and *simple_header.html, the template directory also contains the templates that you would like to change (!). *) These must be present.

createastylephpBB327.png
Original style.cfg:

Code: Select all

#
# phpBB Style Configuration File
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @license GNU General Public License, version 2 (GPL-2.0)
#
# For full copyright and license information, please see
# the docs/CREDITS.txt file.
#
# At the left is the name, please do not change this
# At the right the value is entered
#
# Values get trimmed, if you want to add a space in front or at the end of
# the value, then enclose the value with single or double quotes.
# Single and double quotes do not need to be escaped.
#
#

# General Information about this style
name = prosilver
copyright = © phpBB Limited, 2007
style_version = 3.2.7
phpbb_version = 3.2.7

# Defining a different template bitfield
# template_bitfield = //g=

# Parent style
# Set value to empty or to this style's name if this style does not have a parent style
parent = prosilver
And changes style.cfg: Find lines 21 - 25 (!)

Code: Select all

# General Information about this style
name = ownprosilver
copyright = © phpBB Limited, 2007
style_version = 1.0.0
phpbb_version = 3.2.7

This entry ==>

copyright = © phpBB Limited, 2007

please adapt, if necessary.


Changes overall_header.html:

1) find:

Code: Select all

<!--
	phpBB style name: prosilver
	Based on style:   prosilver (this is the default phpBB3 style)
	Original author:  Tom Beddard ( http://www.subBlue.com/ )
	Modified by:
-->
change this lines to: example

Code: Select all

<!--
	phpBB style name: ownprosilver
	Based on style:   prosilver (this is the default phpBB3 style)
	Original author:  Tom Beddard ( http://www.subBlue.com/ )
	Modified by:      Created by your name as ownprosilver
	Credits:          Your details
	Picture credits:  Your details
	Important notes:  Your details
-->
2) find:

Code: Select all

<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet">

<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
	<link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!-- IF S_PLUPLOAD -->
	<link href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!-- IF S_COOKIE_NOTICE -->
	<link href="{T_ASSETS_PATH}/cookieconsent/cookieconsent.min.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!--[if lte IE 9]>
	<link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<![endif]-->
and change this lines to:

Code: Select all

<link href="{ROOT_PATH}styles/prosilver/theme/normalize.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/base.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/utilities.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/common.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/links.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/content.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/buttons.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/cp.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/forms.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/icons.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/colours.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/responsive.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">

<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet">

<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
	<link href="{ROOT_PATH}styles/prosilver/theme/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!-- IF S_PLUPLOAD -->
	<link href="{ROOT_PATH}styles/prosilver/theme/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!-- IF S_COOKIE_NOTICE -->
	<link href="{T_ASSETS_PATH}/cookieconsent/cookieconsent.min.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!--[if lte IE 9]>
	<link href="{{ T_THEME_PATH }}/tweaks.css?assets_version={{ T_ASSETS_VERSION }}" rel="stylesheet">
<![endif]-->

Changes simple_header.html:

find:

Code: Select all

<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet">

<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
	<link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!--[if lte IE 8]>
	<link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<![endif]-->

<!-- DEFINE $POPUP = 1 -->

<!-- EVENT simple_header_head_append -->

{$STYLESHEETS}

<!-- EVENT simple_header_stylesheets_after -->

</head>

<body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}">
and change this lines to:

Code: Select all

<link href="{ROOT_PATH}styles/prosilver/theme/normalize.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/base.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/utilities.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/common.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/links.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/content.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/buttons.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/cp.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/forms.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/icons.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/colours.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<link href="{ROOT_PATH}styles/prosilver/theme/responsive.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">

<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LINK}" rel="stylesheet">
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet">

<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
	<link href="{ROOT_PATH}styles/prosilver/theme/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->

<!--[if lte IE 8]>
	<link href="{{ T_THEME_PATH }}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<![endif]-->

<!-- DEFINE $POPUP = 1 -->

<!-- EVENT simple_header_head_append -->

{$STYLESHEETS}

<!-- EVENT simple_header_stylesheets_after -->

</head>

<body id="phpbb" class="simple nojs {S_CONTENT_DIRECTION} {BODY_CLASS}">
Changes overall_footer.html:

find:

Code: Select all

<!-- IF DEBUG_OUTPUT -->
and add before:

Code: Select all

<p class="footer-row">Style: ownprosilver - created by <a class="footer-link text-strong" href="#">Your Name</a></p>
Replace the placeholder with your link.


Now your stylesheet.css into the folder --> styles/ownprosilver/theme
Your stylesheet directory contains only your changes (CSS) and this will override the default (CSS prosilver). Always note the sequence in which stylesheets are "overwritten".

Only some examples for some classes: Here are just a few examples ....

Code: Select all

/*
phpBB-3.2.x Style Sheet
----------------------------------------------------------------------
	Style name:			ownprosilver
	Based on style:		prosilver (the default phpBB 3.2.x style)
	Original author:	Tom Beddard ( http://www.subblue.com/ )
	Modified by:		your name myself ( your website )
----------------------------------------------------------------------
*/

html, body {
	color: #000000;
	background-color: #FAFAFA;
}

body {
	margin: 0 auto;
	background: #FAFAFA url("./images/mybgimage.jpg");
	background-attachment: fixed;
	background-position: right top;
	background-repeat: no-repeat;
}

h2 {
	font-size: 1.9em;
}

/* Round cornered boxes and backgrounds
---------------------------------------- */

.headerbar {
	background-color: #010423;
	background-image: linear-gradient(to bottom, #010423, #4169E1, #010101);
	background-image: -webkit-linear-gradient(top, #010423 0%, #4169E1 48%, #010101 100%);
	filter: none;
	background-repeat: repeat;
	border: 2px solid #2835A1;
	margin-bottom: 11px;
}

.forabg {
	background-color: #010423;
	background-image: linear-gradient(to bottom, #010423, #4169E1, #010101);
	background-image: -webkit-linear-gradient(top, #010423 0%, #4169E1 48%, #010101 100%);
	filter: none;
	background-repeat: repeat-x;
}

.forumbg {
	background-color: #010423;
	background-image: linear-gradient(to bottom, #010423, #4169E1, #010101);
	background-image: -webkit-linear-gradient(top, #010423 0%, #4169E1 48%, #010101 100%);
	filter: none;
	background-repeat: repeat-x;
}

/*
--------------------------------------------------------------
Colours and backgrounds for links.css
-------------------------------------------------------------- */

a.forumtitle {
	text-decoration: none;
}

a.forumtitle:hover {
	text-decoration: underline;
}

/* Common, Content, Responsive, Button, Icons etc. ADDs
--------------------------------------------------------- */
.wrap {
	max-width: 1280px;
}

.wrap, .headerbar, .navbar, .forabg, .forumbg, .panel, .post {
	border-radius: 0px;
}

/* responsive design
---------------------------------- */

@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
	body {
	background-image: none;
	filter: none;
	}
}

@media only screen and (max-width: 701px), only screen and (max-device-width: 701px) {
	.wrap {
	max-width: 1152px;
	}
}
It means, create your stylesheet.

Important: tweaks.css
if you wish to amend those classes referred to therein, they must match their adaptations.
/* Style Sheet Tweaks

These style definitions are IE 8 & 9 only.
They are required due to the poor CSS support in IE browsers.
------------------------------------------------------------------------------*/
.headerbar, .forumbg {
...
}
.forabg {
...
}
==> It means: these must also be adapted the tweaks.css.


It should work, good luck and best regards!


======
*) Edit
======

:) Hint: 06.09.2019
createastylephpBB327img.png
Continued, next step: Ideally, add the images folder and the language-based folders for the online icon to the theme directory. Now it is possible to act with different graphics, pictures, online symbols (compare no.: 4 in the attached graphic).

Regards
You do not have the required permissions to view the files attached to this post.
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cant figure out how to create style with inherit

Post by BigDrago »

Thanks. Tried EA117 approach and it worked.

Let´s say I want to tweak colours.css on myowntheme. I copy colours.css to my own folder and myowntheme will use that .css?

I want to change site_logo to my own for users using myowntheme. How do I do that? Can I make the logo adjust automatically based on screen size and for cellphone users?

Sorry for all the questions. Been a time since I´ve editing styles in phpbb.
User avatar
EA117
Registered User
Posts: 2175
Joined: Wed Aug 15, 2018 3:23 am

Re: Cant figure out how to create style with inherit

Post by EA117 »

BigDrago wrote: Sat Sep 07, 2019 8:11 pm Let´s say I want to tweak colours.css on myowntheme. I copy colours.css to my own folder and myowntheme will use that .css?
Not exactly. The way CSS works doesn't allow for phpBB's "inheritance" behavior to work exactly the same way as it works for template (.html) files. And is what https://www.phpbb.com/styles/create/ is referring to when it said "The biggest obstacle for most style authors is the fact that the inheritance tree only works for templates, not CSS."

So although "copying /styles/myown/template/overall_header.html" into your style would begin causing phpBB to start using your style's version of the overall_header.html template instead of /styles/prosilver/template/overall_header.html, the same is not true for "copying colours.css into your style directory."

Nor would you want to literally "copy colours.css and have that be used instead of prosilver's colours.css", at least not in this case. You want prosilver's version of colours.css to continue being used, so that when phpBB updates prosilver and makes a couple tweaks or fixes to colours.css, your style will inherit those fixes rather than being stuck with your "old" static copy.

So what you want is to create a local blank .css file in your style. It can be named colours.css if this helps you keep track of which prosilver CSS sheet's definitions you're tweaking, but what you name the file isn't really important and can be whatever you prefer. Since you gave a hint as to your intention, let's use "logo.css" as the file you create in this example.

Then you will update your style's stylesheet.css so that in addition to importing 100% of prosilver's stylesheet.css, it now also includes your additional style-specific CSS file(s), such as:

Code: Select all

/* Inherit all of proSilver style sheets */
@import url("../../prosilver/theme/stylesheet.css");

/* Load additional style sheets specific to your theme */
@import url("logo.css");
Now inside your style-specific logo.css file (or whatever you've named it), you would put only the CSS definitions that you want to further extend or override, compared to what prosilver's CSS is already doing (and is still doing) for your style. So you do not want to start out with logo.css containing "a complete copy of prosilver's existing colours.css" or anything like that; you want to define only that CSS which is necessary to change the behavior you're intending to change.

BigDrago wrote: Sat Sep 07, 2019 8:11 pm Can I make the logo adjust automatically based on screen size and for cellphone users?
That's a perfect example of a situation where you want to ensure "my style will continue to inherit as close to 100% as possible any changes phpBB makes to the underlying proSilver", because the changes you're doing are otherwise very minimal.

So if we continue with the "I have created an additional logo.css file to contain CSS changes unique to my style" example described above, in order to actually change the logo, you'll extend and override what prosilver defines for the site logo (in prosilver's colours.css) by putting the following in your /styles/myown/theme/logo.css file that you're now including from your /styles/myown/theme/stylesheet.css:

Code: Select all

.site_logo {
	background-image: url("./images/my_site_logo.png");
}
Note you can add alternate height: and width: to that definition as needed, too. Anything you define at this point is "after" and therefore overrides whatever prosilver had defined for these same CSS element path properties.

And so then finally, now you need to create the /styles/myown/theme/images/ folder, because now you actually have an image which is specific to your style. (The "./images/my_site_logo.png" image.) The web browser will want to load this "./images/my_site_logo.png" file from /styles/myown/theme/images/, because the "./images/" path is relative to your style-specific /styles/myown/theme/logo.css file (or whatever you chose to name that file) in which your .site_logo{ background-image: url("./images/my_site_logo.png"); } declaration was made.

BigDrago wrote: Sat Sep 07, 2019 8:11 pm Can I make the logo adjust automatically based on screen size and for cellphone users?
prosilver's responsive.css style sheet contains any CSS changes that should apply as the screen width falls below certain thresholds, and your style is already receiving all of those by virtue of @import url("../../prosilver/theme/stylesheet.css").

You can now add your own @media (max-width: ) { } blocks to your style-specific logo.css in order to further override the otherwise prosilver-defined behavior. For example, the logo currently "disappears" on mobile devices because of the following block in prosilver's responsive.css:

Code: Select all

@media (max-width: 700px) {
...
	.logo {
		/* change display value to inline-block to show logo */
		display: none;
		float: none;
		padding: 10px;
	}
...
}
In other words, if the screen size falls to 700px wide or less, prosilver has changed the <a class="logo"> link that encapsulates the logo image display such that it is display: none. So you could then create your own @media (max-width: 700px) { } block in your style's logo.css, and make your own further decisions about which of these prosilver behaviors to undo & what additional behaviors you want instead for your style.

Note that because the site logo image is actually attached as a background to the <span class="site_logo">, changing the behaviors you want (such as switching to a different image on mobile displays) would involve adding CSS for paths other than just .logo. For example, your style's logo.css could end up looking like:

Code: Select all

.site_logo {
	background-image: url("./images/my_site_logo.png");
}

@media (max-width: 700px) {

	.logo {
		/* changed display value to inline-block to show logo on mobile instead of hide */
		display: inline-block;
	}
	
	.site_logo {
		/* use alternative logo file on mobile displays */
		background-image: url("./images/my_smaller_site_logo.png");
		height: 25px;
		width: 25px;
	}

}

So at this point, if you had only done exactly the changes described in the examples thus far, your alternate style would now be comprised of just the following files:

/styles/myown/style.cfg (with parent=prosilver in addition to the other details)
/styles/myown/theme/stylesheet.css (containing @import url("../../prosilver/theme/stylesheet.css"); and now also @import url("logo.css");)
/styles/myown/theme/en/stylesheet.css (containing only @import url("../../../prosilver/theme/en/stylesheet.css");)
/styles/myown/theme/bidi.css (containing only @import url("../../prosilver/theme/bidi.css");)
/styles/myown/theme/plupload.css (containing only @import url("../../prosilver/theme/plupload.css");)
/styles/myown/theme/print.css (containing only @import url("../../prosilver/theme/print.css");)
/styles/myown/theme/tweaks.css (containing only @import url("../../prosilver/theme/tweaks.css");)
/styles/myown/theme/logo.css (containing only the .site_logo and @media sections described)
/styles/myown/theme/images/my_site_logo.png (for use instead of the prosilver default logo)
/styles/myown/theme/images/my_smaller_site_logo.png (for use on mobile displays)


And nothing else.
BigDrago
Registered User
Posts: 370
Joined: Fri Dec 10, 2004 5:16 pm
Location: Norway

Re: Cant figure out how to create style with inherit

Post by BigDrago »

Thank you so much for your good answer! Really appreciate it.
I want to make the logo fill the top boarder.

I found ext that allows the logo on top to be responsive, move search to under top boarder etc. But it cant edit each style. I have different styles on the same board.
viewtopic.php?f=456&t=2400186
User avatar
Talk19Zehn
Registered User
Posts: 917
Joined: Tue Aug 09, 2011 1:10 pm

Re: Cant figure out how to create style with inherit

Post by Talk19Zehn »

Hello, test perhaps this EXT also: Maybe a try for a remedy.

Logo: Alternative you can try out that extension: Sitelogo responsive
http://reyno41.bplaced.net/phpbb/viewto ... f=41&t=217

BTW: It can always be that individual adjustments are necessary, even if you use extensions. Yes, thats right, the style concept is crucial ...

Regards

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