Example theme: Spring Bloom
|
Posted
#42941
(In Topic #9553)
|
|
|---|---|
|
ocStaff (admin) |
Open Source Web Design - Preview - Spring Bloom I'm actually really pleased with how it turned out. I intentionally started with a really pretty template that wasn't too assumptive about content structure (e.g. didn't have loads of internal columns), then I just started mixing in the code into a new ocPortal theme. Total build time: just 3 hours. Consider this a beta release, as I haven't tested this theme in anything other than Firefox. I'm hoping the original template I based it off was cross-browser tested, and if it is this in theory should work on different browsers also. I'm going to explain how I made this next. I'll be something of a case study If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
|
Posted
|
|
|
ocStaff (admin) |
Spring Bloom, the making of(I'm not going to mention all the little mistakes I made and corrected during the making of this - I'm human too so sometimes I do things, and change my mind and go back Once I'd found Spring Bloom (I've never seen it before today) the first thing I did was run the Theme Wizard, to colour match a new ocPortal theme against the pink/purple tone the template has. Beware of how I'm using the word "template" there – "templates" in this sense are HTML and CSS files that you use as a "template" to build your own site – it's not the same as an ocPortal template. This was pretty straight forward- I very quickly had a purple theme named "spring_bloom" that I could use for as a base for further editing. I don't want to self-congratulate, but the Theme Wizard is a totally amazing thing: without it, I'd have had to do an enormous job of hand editing 100's of CSS colours and images to match the purple, and that would have taken days. The next step was for me to copy some templates into my theme that I knew I wanted to override. I should say I personally work in a text editor (specifically I am currently a Mac user, running 'TextMate')- I don't actually use ocPortal's own template editing interface myself, but this is really because as a programmer I am so used to text editors. It's convenient for me to be able to edit PHP and TPL files together should I want to. So this process of copying files is just the way I work- other people might instead choose to override files one-by-one using the ocPortal template editor. I know from experience what are the common templates to edit. There are 3 obvious ones: HEADER, GLOBAL, and FOOTER. But the other ones are standard box and menu templates. From looking at the design I knew I was going to implement that menu in the header as a 'top' menu, so I overrode the set of 'top' menu templates. I overrode all the standard box templates, as clearly this theme's use of boxes wasn't going to be anything like ocPortal's default themes. This theme is has pretty 'clean' style (this is not a value judgement: style is the operative word here, dependant on taste and situation). Once I'd overridden the key templates into my new theme, I had to start replicating the XHTML structure of the original Spring Bloom template into my own .tpl files. This is quite a fiddly thing to do, because you're trying to combine two things that have never seen each other before. I used a number of techniques:
In parallel to the above XHTML merge, I was merging CSS. I started this process by dumping the whole Spring Bloom CSS into the top of my global.css file. And as I merged concepts, I was using various techniques:
So what was 'egregious'? One thing was that Spring Bloom had something called a 'CSS reset'. This is a common technique where a web developer will disable default browser styles so that when they write their CSS, they're starting from a clean sheet. That's all fine and good, except we don't want huge swaves of ocPortal, which was not built with a CSS reset, to be affected by all this. Let's get specific, this is what I'm talking about: Code
* {
So the solution to this was to take it out, but reapply the removal of margins, borders, and padding, into all the individual Spring Bloom CSS rules as required- achieving the same visual effect, but no longer sweeping over the whole of ocPortal. Another issue is this template did make some assumptions by applying some pretty liberal selectors in the CSS. For example, all lists in the sidebar were styled in a way only appropriate for "link lists". Sometimes there is a bit of a gulf between the mindset of a CSS developer who works from scratch, and the mindset of someone who is working in a wider system: we, working in a wider system, have to be more modular in our thinking, and can't make assumptions like this. So the solution was to make the selectors more specific; in the case of the example, the "link list" styling was only applied for the lists used in menus (which is great, exactly what we wanted!) Spring Bloom assumed there would always be a sidebar, and always be a main section. Of course, in ocPortal, sometimes there is no sidebar and thus the main section stretches full width. This is why ocPortal's default theme has a tonne of logic in GLOBAL.tpl that sets margins and widths, according to whether there are panels or not. It was easy to sort out- I just pulled out the width for the main section from the CSS, and made it an inline style in GLOBAL.tpl as per ocPortal's default theme; I used only slightly modified default-theme logic to determine what that width had to be. Another issue is that the font size is quite small on this theme. That's fine, except ocPortal sometimes uses "smaller" fonts to show what I call "asides". I had to remove every font styling that made small fonts from the CSS files. I just nuked all the lines like "font-size: 0.8em;". It's also worth me saying that this is a fixed-width theme that works on 800x600. Woohoo, we now have an ocPortal theme that can do that! But it did involve me tweaking some styles to make things more compact. In particular, the member/guest bars at the top of the forum: I had to adjust them so that each "column" in the bar would have wordwrapping, and be less wide. So, how did I get new theme images in, like the images used in the header? It's really easy, I just copied the image files into the theme's images_custom directory, and referred to them in the CSS as theme images like: Code
background:#fff url('{$IMG;,background_body}') repeat-x top;
Code
background:#fff url('image/background_body.jpg') repeat-x top;
To implement my new standard boxes, I nuked most of ocPortal's default standard box CSS, and tied in the Spring Bloom CSS files to point to the CSS class names ocPortal uses for the standard boxes. I only needed two kinds of standard box: the panel type, and everything else. So I hacked up the HTML for the panel and classic box types to meet my needs, and then I set the other box templates to simply link to the classic box type, by putting just this in their templates: Code
{+START,INCLUDE,STANDARDBOX_classic}{+END}
I think I've pretty much explained all the processes I went through now. There were of course more details, but generally it's in the same vein as other things discussed here. One closing note: I am in love with the Firefox Firebug extension (and all other browsers have similar tools now too): it is incredibly handy to be able to inspect different XHTML tags and see where they get their styling from. For example, I often compared what styles applied in ocPortal, to what applied in the demo of the plain Spring Bloom template - to see the origin of rendering differences. Ok, that's all from me for now. Hopefully this will be a good resource for people wanting to make their own themes!
Last edit: by Chris Graham
If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
|
Posted
|
|
|
Hallowed customer |
A starting point for all would-be 'Themers'. |
|
Posted
|
|
|
Community saint |
TIA! SD
"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved OCP V7 | Advocating monetary reform - FreeOurMoney Need OCP friendly hosting? Look no further: Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal. |
|
Posted
|
|
|
ocStaff (admin) |
The zone menu is a regular ocPortal menu, loaded up by this line in HEADER.tpl: Code
{$BLOCK,block=side_stored_menu,param=_zone_menu,type=zone}
The first thing I'm going to do is open up all the MENU*zone*.tpl files in my text editor, to see what's in them. The template file that 'wraps' the contents of the menu is MENU_zone.tpl. This contains: Code
<ul class="nl">{CONTENT}</ul>
Searching global.css for .nl (styling applied to XHTML tags of the "nl" class") reveals just this code: Code
.nl, .nl ul {
That styling code doesn't really do very much. Really it just makes the list not look like a list, by disabling default list styles. Hmm, so ok I actually mis-trod there and didn't find what I was looking for. Looking back in HEADER.tpl I can see actually the menu block is surrounded by a div tag with class name "global_zones". If I look for that in global.css I find a big chunk of code: Code
.global_zones {
In my next post I'll annotate this code. To be honest, I'm not sure how directly helpful this all is to you SD – I can't honestly see how the "zone" menu type would interfere with the styling of another menu type. All they have in common is that they use lists - the set of templates and CSS classes are completely separate.
Last edit: by Chris Graham
If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
|
Posted
|
|
|
Community saint |
Thank you kind sir, I'm diving back in. (I'm hoping to pull off a new theme in one day)
"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved OCP V7 | Advocating monetary reform - FreeOurMoney Need OCP friendly hosting? Look no further: Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal. |
|
Posted
|
|
|
ocStaff (admin) |
If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
|
Posted
|
|
Hallowed customer |
I run Otaku Play Ground and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
|
|
Posted
|
|
|
Fan in action |
but how do i upload it. or how? so far i've style>>themes>>mangae themes>>> (bottom) import an add on. I have tried unzipped, no go ('support no turned on for ini) i have tryed upload zip (The file upload was not a supported addon type.) Im at a lose… help plz I have read here ocPortal.com - ocPortal Tutorial: Themeing your site but dont see the instructions for "uploading a template." are they located elsewhere? could you link me to where.. thanks in advance.
An Aquarium of Parents @ Parentarium.com
An Aquarium Of Parents - Parentarium: For Moms, Dads and Grand Parents to have their own parenting Fun ocportal test area: For Moms, Dads, Step and Grand Parents to find Santuary - Parentarium |
|
Posted
|
|
|
ocStaff (admin) |
If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
|
Posted
|
|
|
Fan in action |
sorry, so much to read in so little time.
kk, Ill start with these in for a base of learning of ocportal template's. then call up this template in ocportal and download (export)it as a themed template. so then to up load at a later date as a 'proper addon' ? thanks again for the reply.
An Aquarium of Parents @ Parentarium.com
An Aquarium Of Parents - Parentarium: For Moms, Dads and Grand Parents to have their own parenting Fun ocportal test area: For Moms, Dads, Step and Grand Parents to find Santuary - Parentarium |
1 guests and 0 members have just viewed this: None
Control functions:








Last edit: by