Topic: CSS Question for Paul

I am looking for a way to keep my custom forum styles separate from the stock punBB styles.  I have read other posts where it has been recommended that any custom styles should be put at the end of the style sheet(s) for easy reference.  I have no problem doing that, but when I predict that I will be using this excellent forum software on many of the sites that I have either already completed, or are in the planning stages.  I am worried that when upgrades are applied, (especially if I am not doing the upgrade), that the style mods I have made will be lost or forgotten.  Do you oppose, or recommend making a separate style sheet for all custom or modded styles, that can be imported like base.css and *_cs.css files are?

I am just looking for the best and easiest way of keeping my custom styles intact.  Fully realizing that best and easiest is not always the same solution.  I have already run into a problem where a client has found that there was an upgrade available and applied it before I had a chance to warn him.  Luckily I had a backup.  My thoughts are that if they by chance happen to overwrite the styles during an upgrade, that all I need to do is tell them to open the main CSS file and add:

/* Import the custom styles*/
@import url(imports/custom.css);

below

/* Import the colour scheme */
@import url(imports/Oxygen_cs.css);

Your thoughts?

Re: CSS Question for Paul

that would work fine

3

Re: CSS Question for Paul

Using import for your own styles is fine. One tip, if you are going to override the existing styles rather than edit them then make the selectors more specific. One easy way of doing this is to use #punwrap. For example if the existing stylesheet has something like .pun P {color: red} then using #punwrap .pun P {color: white} will always overrule it.

Just so you know, there are no minor changes to the style sheets or the markup planned. I think there is one small fix needed for profile.php to remedy a Safari bug but that won't impact on anybody.

There are major changes planned though exactly what and when is still under discussion. There are arguments for putting changes in sooner rather than later and then freezing the markup and css for the remainder of 1.2 and 1.3. There are also arguments saying dont make major changes except when there is a major version release. When that happens you will have to make changes to your own style(s) anyway. The changes should include

- Dispensing with clearer divs
- Probably dispensing with one layer of divs, most likely <div class="inbox">
- Some improvements to make integration less of a headache.
- less use of floats
- trying to design out some of the hacks
- generally tidying up and, hopefully simpifying, the css

Once that load of changes are in I would really like to see the markup and css frozen for a considerable time to allow styles to be developed without fear of them becoming outdated very quickly.

4

Re: CSS Question for Paul

buzzkill wrote:

I have already run into a problem where a client has found that there was an upgrade available and applied it before I had a chance to warn him.

Once bitten, twice shy.

The same thing happened to me, now I'm a bit more careful when it comes to templates and CSS overwrites.

5

Re: CSS Question for Paul

Just a thought. Would it be a good idea to put the version number of stylesheets in a comment at the top e.g. if you install PunBB 1.2.4 and the stylesheets that come with it are labelled 1.2.1 then you know there have been no changes.

Re: CSS Question for Paul

Well, you might also think you're using old, outdated stylesheets tongue

7

Re: CSS Question for Paul

Paul wrote:

Just a thought. Would it be a good idea to put the version number of stylesheets in a comment at the top e.g. if you install PunBB 1.2.4 and the stylesheets that come with it are labelled 1.2.1 then you know there have been no changes.

That would be a good idea but if it's included in the changed files, then it's a given.

Looking forward, it would be nice to have the /styles and /include/template be outside the scope of the core. when changing a site, these two areas are affected the most. I know that whenever a major version comes out the templates and CSS do change somewhat.

So in order for our styles to follow us from rev to rev, there has to be some kind of abstraction. I know, I'm talking about some kind of skinning or templating system, but it would alleviate upgrades and bring more styles to the table.

Re: CSS Question for Paul

Thanks everyone for your comments.

hcgtv wrote:

So in order for our styles to follow us from rev to rev, there has to be some kind of abstraction. I know, I'm talking about some kind of skinning or templating system, but it would alleviate upgrades and bring more styles to the table.

I think your idea of skinning/templating is a good one.  I know this is not phpBB, but have you ever tried to decipher phpBB or Vbulltin templates?  The last time I did, it was not for the beginner, and I had a rather hard time understanding it at first.  punBB has been a gift from the gods.  Even back in the 1.1 days, it took only a short time to figure out how to wrap it into your own design.  The first BB/forum I ever used was Vbulletin, and yes I did pay for it roll.  This was before I knew of free scripts, and was very new to php & webdev in general.  One of the things they did have that I thought was rather nice, and helped me tremendously was a "style cheat sheet" that had a screen capture of a forum display and notes as to what color setting was associated with specific areas of the display.  Kind of like if I were to draw an arrow to the H2 header in "Post a reply" and state that this is set here -> in the config.  VB, XMB and I believe phpBB use the admin interface to change colors of elements on the page.  I know that XMB stores this "color" scheme information in an SQL table.  I am not in favor of this due to the potential load it may put on a server every time it loads a page and calls the information from the database.

It?s a nice feature to be able to adjust color schemes in the admin interface.  Is there a way that it can be cached instead of calling the database each time a page loads, while still adhering to the K.I.S.S. methodology?

I am forever a huge fan of punBB, and the community that surrounds it.  Authors actually view and reply to posts without attitude, and I come away with a better knowledge of how punBB works, as well as learn a trick or two about PHP/MySQL/CSS every time I visit the site.

Thanks again!

9

Re: CSS Question for Paul

If I were trying to come up with an alternative system I would do something like this. The php files would generate smaller snippets of xhtml consisting of the xhtml which immediatelly enclosed the content. These snippets could then be assembled using a .tpl file which contained the markup for the containers.  Since the bits of xhtml in the php file would be the semantically correct tags for the content they contained there is no reason why they would ever need to be edited. For example footer.php would generate the tags for the lists which contain the information and the containing divs would be in the tpl file with the variables representing the lists placed wherever the author wanted. The variables representing the items would of course be named to indicate the nature of the tags and any id/class names e.g. <dl_userinfo_conl> to indicate a definition list was being inserted with an id=userinfo and class=conl.

This is not a suggestion for future development, its just the way I would do it if I was so inclined. There is bound to be some performance impact though because of the increased amount of merging that it taking place to generate the final page.

One downside of templating is that you do end up with more redundant markup because the markup has to be able to accomodate whatever content is thrown at it. With the markup all being in the php files it can be made totally conditional upon the content thus avoiding empty tags and such like.

10

Re: CSS Question for Paul

Plugin suggestion: what about generating colour scheme stylesheets in exactly the same way as news item e.g. have a file css.tpl with item such as
.pun th {background-color: <my_th_bg>}
and then merge it with the values from a form. The main stylesheet could be created by simply having a copy of Oxygen saved as a .tpl file with the import being a variable set to whatever you decide to name your new style.

11

Re: CSS Question for Paul

Paul, I think that you would be the best person to come up with a templating system scheme.

I know that the speed of punBB is why so many of us use it. I was just reading some posts on an Invision Power Board forum and it was to say the least, a bit dogged, I could see Firefox painting the screen.

But I believe that a scheme could be devised where the speed is impacted very little with a huge leap in customization for the end user.

Just my 2cents.

12

Re: CSS Question for Paul

Performance is the most important thing. I see all these requests for features but for my money the simple pleasure of just being able to click back and forward between pages without waiting outweights pretty much everything else.

I think the chances of seeing a templating scheme are somewhat unlikely. It also has to be said that one could do most of what could be done with a templating system with css if only one didn't keep running into that brick wall known as Internet Explorer.

13

Re: CSS Question for Paul

Paul, I hear you, I love speed over everything else.

From my own experience in using Nucleus, a well designed templating system close to the core has very little impact with the operation of a system.

If you visit any my sites and experience a slowdown, it's probably the Google ads wink

14

Re: CSS Question for Paul

You will have to explain the Nucleus skinning system to me one day. I took one look at it and experienced brain cell death on a large scale.

15

Re: CSS Question for Paul

Whenever you'd like, I can say I'm somewhat familiar with the skinning aspect of Nucleus. I've already ported 3 skins for our skins site and assisted in the new default skin for v3.2. Honestly, it's more CSS knowledge than anything else.

As far as how the core does it, I haven't delved into the code yet.

Re: CSS Question for Paul

Paul wrote:

Plugin suggestion: what about generating colour scheme stylesheets in exactly the same way as news item e.g. have a file css.tpl with item such as
.pun th {background-color: <my_th_bg>}
and then merge it with the values from a form. The main stylesheet could be created by simply having a copy of Oxygen saved as a .tpl file with the import being a variable set to whatever you decide to name your new style.

i was thinking of making this for mypunbb since lots of people want different colour schemes but no one on it knows how to make them

Re: CSS Question for Paul

if you build it they will use it. big_smile

i know i would like something like this for sure.

~James
FluxBB - Less is more