MyBB Community Forums

Full Version: I'm scared to start making themes.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've been a web developer for 6 years so far. I've made websites for at-least hundreds of clients. I've made hand coded websites, built my own CMS, built hundreds of WP themes, and more. Theme development isn't new to me.

However, I look at MyBB's code, I open up a template and what do I see? Tables, tables everywhere. I mean I don't even know which tr leads to which. I have to dig through code through code to figure out which element to style, I have to add classes to elements, I have to use dreaded <br> tags...

Not to hate on the developer, but the ONLY theme I found that I actually liked and can work with from a base was Apart 1's theme, HOWEVER, it just broke mods, actually - I'm stuck with a broken MyAlerts plugin because if I disable, the whole theme is borked and there is no way I want to spend my time how to fix that. I disabled it once and I had to restore a backup of the forum to get the theme back to normal. Besides breaking mods, I have to use <br>'s still, and HTML clear floats instead of CSS clear's, and I have to use !important to style what I want exactly and if I want to position something, I have to use position property, instead of just margins.

MyBB is the best forum out there, there has yet to be a forum IMO to so much features, stable, and easy to use for ADMINISTRATORS and USERS. But yet, the code behind to make a theme looks like a nightmare.

So I'm asking the other theme developers, who has made themes before and has gotten popular, how do you make themes without the fear of:
  • Mods breaking theme or theme breaking mods
  • Not be scared of tables
  • Edit code with a horrible "advanced css" editor and template/html editor?

I love MyBB and I feel like I can make some pretty damn good themes for it, but I just can't get my self to start coding, I'm scared of how much work I have to do and the trouble I'd have to figure out along the way.
  • Mods breaking theme or theme breaking mods

The only way to make sure the majority of plugins are compatible with your theme is not to modify it too extensively. If you keep the structure as close as possible to the default theme's structure, this shouldn't be too much of an issue.
  • Not be scared of tables

Honestly I'm not sure I know how to answer this one. MyBB's default theme goes back to the early 2000s when using tables was common and after breaking away from XMB it stuck like that as not to break compatibility too much with previous themes. I guess it depends on what you're trying to do. You can do a lot with CSS without needing to touch the HTML.
  • Edit code with a horrible "advanced css" editor and template/html editor?

We've replaced CodePress with CodeMirror in MyBB 1.8 but you can disable it from your Admin Preferences if you find it's too buggy to work with.

There is a Sublime Text plugin which allows you to edit MyBB templates without needed to go near the ACP.

https://github.com/ionutvmi/SublimeMybbTplEditor
(2013-12-16, 01:29 PM)Nathan Malcolm Wrote: [ -> ]
  • Mods breaking theme or theme breaking mods

The only way to make sure the majority of plugins are compatible with your theme is not to modify it too extensively. If you keep the structure as close as possible to the default theme's structure, this shouldn't be too much of an issue.
  • Not be scared of tables

Honestly I'm not sure I know how to answer this one. MyBB's default theme goes back to the early 2000s when using tables was common and after breaking away from XMB it stuck like that as not to break compatibility too much with previous themes. I guess it depends on what you're trying to do. You can do a lot with CSS without needing to touch the HTML.
  • Edit code with a horrible "advanced css" editor and template/html editor?

We've replaced CodePress with CodeMirror in MyBB 1.8 but you can disable it from your Admin Preferences if you find it's too buggy to work with.

There is a Sublime Text plugin which allows you to edit MyBB templates without needed to go near the ACP.

https://github.com/ionutvmi/SublimeMybbTplEditor

Thanks for replying.

Okay, so, will you guys be changing this "must be close to default template" thing? I've never seen a limitation like that, but it can be worked with. Thankfully with some class names, css can be powerful.

Thanks, I was looking at that plugin actually, my only worries is that it'll break one day (But I find that unlikely any time soon though...) That with HTMLPUrifier, it shouldn't be too much of a pain.

About the editor, I was talking about 1.6's, it's just an input box. No tab support or anything. Is there any way to change that?
Regarding MyAlerts, I tried to make it as easy to style as possible. If you're having issues such as what you described, try using your browser's dev tools and looking at it again.
Quote:Okay, so, will you guys be changing this "must be close to default template" thing? I've never seen a limitation like that, but it can be worked with. Thankfully with some class names, css can be powerful.

It's not really a limitation we've imposed. The plugin developers set what code to look for in a specific template, and MyBB modifies the template according to the logic in the plugin. So a plugin could ask MyBB to find a specific <td> in a template but if it isn't there MyBB can't do anything about it.

Quote:About the editor, I was talking about 1.6's, it's just an input box. No tab support or anything. Is there any way to change that?

Not unless you replace CodePress itself, which we've already done for 1.8. CodeMirror has tab support.
(2013-12-17, 10:25 AM)Nathan Malcolm Wrote: [ -> ]So a plugin could ask MyBB to find a specific <td> in a template but if it isn't there MyBB can't do anything about it.

You can at least make the find_replace_templatesets function more user-friendly, for example by outputing an error with templates which couldn't be modified in specific themes during installation/activation/deactivation/deinstallation.
(2013-12-17, 06:38 PM)Destroy666 Wrote: [ -> ]
(2013-12-17, 10:25 AM)Nathan Malcolm Wrote: [ -> ]So a plugin could ask MyBB to find a specific <td> in a template but if it isn't there MyBB can't do anything about it.

You can at least make the find_replace_templatesets function more user-friendly, for example by outputing an error with templates which couldn't be modified in specific themes during installation/activation/deactivation/deinstallation.

And thus breaking every single plugin that doesn't handle said error. I'm all for making life easier for developers, but not at the cost of backwards compatibility.
Who said it has to break plugins? I'm quite sure it can be done by only modifying core files with edits similar to these: http://community.mybb.com/thread-148259.html Do they break theme compatibility? I don't think so.

There is this code in find_replace_templatesets:
if($new_template == $template['template'])
		{
			continue;
		}
Instead of simply breaking it with continue, it could also add the name of template + failed edits ($find, $replace) to an array and return it. Then activate/deactivate/uninstall/install functions could handle it after several other core modifications.
The way you said it sounded like it should be throwing an exception or something. Returning an array would be fine, but I'm willing to bet 99% of plugging developers won't do anything about it. The best you'll get is a notice saying "X template change could not be applied to Y", but only if developers know about it and can be bothered to change their ways.
(2013-12-17, 10:25 AM)Nathan Malcolm Wrote: [ -> ]
Quote:Okay, so, will you guys be changing this "must be close to default template" thing? I've never seen a limitation like that, but it can be worked with. Thankfully with some class names, css can be powerful.

It's not really a limitation we've imposed. The plugin developers set what code to look for in a specific template, and MyBB modifies the template according to the logic in the plugin. So a plugin could ask MyBB to find a specific <td> in a template but if it isn't there MyBB can't do anything about it.

So I'm not much of a hardcore PHP dev like you guys are. But instead of devs finding elements, how about impose some kinda attribute for elements to work with so theme devs can use any kinda element they want instead of just one one that's expected by every theme.

For example, instead of finding a td, how about custom data-* HTML5 attributes that can be used via JavaScript as well, for example, data-threadsubscribe. And add a system that checks if these data-* elements exist or not, or maybe even require them for mods, or add a message to the user when uploading themes "Your theme doesn't support all of the data attributes required, some mods may break"
Pages: 1 2