Topic: get css out of code

I would like to suggest/request, to get as much css (and html) as possible out of the code.

As an example I'll use the main.tpl file:
there's the code <pun_title>, and that displays not only the title, but also puts it inside a h1 tag and some span (without id nor class). I think it would be usefull that only the title is displayed by <pun_title>.

1)That way it is much easier to modify the template.
2)If only the template has to be altered (eg leaving out the h1 in the tpl file), there's a higher probability one doesn't have to change everything back after upgrading all those non-tpl files.

Re: get css out of code

But the idea is that you would change that through the style sheets.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: get css out of code

1. There is no css in the code apart from a couple of items inserted by parser.php for posts.

2. What you suggest would require template files for each page. The whole idea is that PunBB should be styled using css only.

3. The example you gave, there is no reason why you would need an id or class on the h1 since there is only one instance of it. If you want to style the nested span then you just use a descendant selector - H1 SPAN {}. However, there is a potential conflict if your page already has an H1 so you are probably right that this particular example needs changing.

Re: get css out of code

You're right about the css. It should be "html".

I gave the example of the h1 because a h1 sets a lot of style for what is contained in the tag. It's difficult to get this look like something yo have styled in a div everywhere else.

I see the point about templates. This would indeed increase the number of template files somewhat, like phpbb has hundreds of them. But now I have to go through all the files to find out where eg <pun_title> is made, and change it there. My fear is that all this work will be worth nothing as soon as an update (however small) requires me to replace those files.

ps: there's a small comment confusion in the header.php file, on line 132/134: <pun_title> instead of <pun_page>

Re: get css out of code

mephisto wrote:

I see the point about templates. This would indeed increase the number of template files somewhat, like phpbb has hundreds of them. But now I have to go through all the files to find out where eg <pun_title> is made, and change it there. My fear is that all this work will be worth nothing as soon as an update (however small) requires me to replace those files.

The idea is that when a new version is released, you would download only the changed files alternatively run the patch. I doubt the templates will change in PunBB 1.2.1 and if they do, the changes are likely to be very minor, so patching shouldn't be a problem.

mephisto wrote:

ps: there's a small comment confusion in the header.php file, on line 132/134: <pun_title> instead of <pun_page>

Noted.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: get css out of code

Thanks for the answers.

Re: get css out of code

Paul wrote:

3. The example you gave, there is no reason why you would need an id or class on the h1 since there is only one instance of it. If you want to style the nested span then you just use a descendant selector - H1 SPAN {}. However, there is a potential conflict if your page already has an H1 so you are probably right that this particular example needs changing.

I have a similar thing in my documentation for my mod, (using the plugin interface, but there's no 'appropiate' headers except h1,h3 and h3+strong for headers of each 'chapter/section ... (h4,h5,h6 are also so tiny it's unusable for that)) ... so, keeping h1, h2, h3 etc. for headers perhaps is a good idea, and instead use div's or something? (but otoh, then those running without css won't get the larger texts etc, but ... ah well... it's not just black and white ...:))

8

Re: get css out of code

I think semantically it is black and white, the board title is an H1 unless there is already a site H1 on the page. Chapters are H2 and sections are H3 (unless of course there are already inside an H2).

The thought of a mod that requires a whole user manual is a bit daunting. What is this, punportal, punblog, puncms, punwiki, punexpressomaker

9 (edited by Frank H 2005-01-27 14:33)

Re: get css out of code

The attachment mod ... explains everything about the mod ... (why it functions as it does, how to make backups the most efficient way, how to add more icons, howto set rules, what orphans are, and also some stuff on what's in the database, what functions exist etc.)

H2 is occupied by the block headers, so only h3 'free', as the h4-h6 are more subscripts than headlines ... (I haven't replaced H1 yet out of it, but will, unfortunately I'll probably need to add some divs with style='' to be able to get decent formatting of that document, as someone could use h1 other than the default ... and I won't start modding the CSS files, I rather skip the documentation than to need to alter at least 4 more files (have tried to keep edits in files to a minimum))

(oh, and to me nothing is as clear as black and white, everything are always in a shade of grey wink)

Re: get css out of code

I really can't see anything wrong with adding a bit of inline styles in this case.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

11

Re: get css out of code

Actually I think inline styles are a good idea for plugins, saves messing about when people produce their own stylesheets.

12

Re: get css out of code

An alike idea goes for <pun_navlinks>:

I was considering putting my own "link back to main site page" in the navlinks list.
Would have been pretty simple, if the <div><ul>...</ul></div> would have been in the main.tpl file.

Just my stupid ideas.

13 (edited by Smartys 2005-01-28 01:26)

Re: get css out of code

In 1.2.1 I believe you'll be able to add stuff to pun_navlinks in the database

Edit: Yup. http://dev.punbb.org/changeset/51

14

Re: get css out of code

Oh please, no!

There's not any need at all to alter the structure of the <h1>.  .punwrap h1 {} will isolate it, as will .brdtitle h1 {}

Also, I don't think in-line styles are ever a good idea, and I can't remember where, but I did encounter one instance of an inline style.  I think that all style should be separated from content so that extermal CSS can do its job without interference from style attributes.  That includes mods.  If someone creates a mod and applies inline styles to make it match Oxygen, then it's more difficult to make it look right in other themes -- or boards with user-selectable themes.

15

Re: get css out of code

roo: It's not a question of isolating the H1, it's already isolated. Semantically speaking each page should only have one H1. If there is a site title above PunBB on the page then that should be the H1. I don't see anything wrong with putting <h1><span><pun_title></span></h1> in the template rather than have it generated by header.php. It doesn't change the output or the css in any way.

As for inline styles, we were only talking about admin plugins. Admin doesn't pick up other styles anyway apart from colour scheme changes and text size.

Frank H. There is nothing wrong with H4, H5 and H6 as headers. Semantically they are still headings and superior to a <p>.

Re: get css out of code

Paul wrote:

Frank H. There is nothing wrong with H4, H5 and H6 as headers. Semantically they are still headings and superior to a <p>.

It may very well be semantically correct, but that doesn't matter cause it look like ---- if the headers are smaller than the text ... thus they are unusable for that use ... but I'll go with inline styles...