Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: OnzeDanny on February 22, 2012, 04:12:03 PM

Title: [APPROVED] SMF Theme Changer 1.0.6
Post by: OnzeDanny on February 22, 2012, 04:12:03 PM
REMOVED
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: NanoSector on February 22, 2012, 04:15:50 PM
That's a nice mod :)

Does it only modify the Source files, though?
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: NanoSector on February 22, 2012, 04:23:35 PM
Quote from: ClickSafe on February 22, 2012, 04:21:17 PM
It change the index.template.php from your templates and adds next code into it:

//ClickSafe Theme Selector START
  if (file_exists($settings['default_theme_dir'].'/changetheme.php')) {require_once($settings['default_theme_dir'].'/changetheme.php');}
//ClickSafe Theme Selector END

So it usable for 99% from all existing the themes!  ;)
That's great! :)

Good luck with waiting until it's approved, I guess :P
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: Matthew K. on February 22, 2012, 04:37:47 PM
As a personal comment, not on behalf of being a Customizer, you can't utilize require_once(); in a template, as it breaks the Model-View-Controller which SMF is built upon (MVC).

It'd be a piece of cake to accomplish this using a source edit only, maybe even hooks, although that may be more tricky than just one source edit to accomplish this.

Furthermore, do you have this hooked in with who can change their theme, the permission?
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: kent[ka] on February 22, 2012, 09:04:18 PM
Can be this option moved to bottom of the site? :p
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: Matthew K. on February 22, 2012, 09:25:17 PM
Very easily...
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: Matthew K. on February 23, 2012, 02:48:33 AM
Quote from: ClickSafe on February 23, 2012, 02:28:51 AM
Quote from: kent[ka] on February 22, 2012, 09:04:18 PM
Can be this option moved to bottom of the site? :p
I will make an option for showing up on top or on bottom off the forum.
Thanks for your opinion  :)
Any reason you're not using $context['insert_after_template'] .= ''; to get rid of template edits completely?
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: Matthew K. on February 23, 2012, 12:58:17 PM
That's no different. When you submit the mod, I'll send you an official review with a suggestion on how to accomplish it without breaking the MVC.
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: kent[ka] on February 25, 2012, 03:40:33 AM
Yeah, well i don't find it really cool to show same option at top and bottom of the page. But it's cool people don't have to move into profile for this switch.
Title: Re: [WIP] ClickSafe:: SMF Theme Changer
Post by: NanoSector on March 17, 2012, 02:10:41 PM
Quote from: ClickSafe on February 27, 2012, 08:19:38 AM
The last day's i have learned a lot  ::)
A special Thanks for Labradoodle-360, who have pointed me to the documentation of using hooks into SMF Mods.
Seems you know more then I do then :)
(I don't understand the *** out of that system)

Lets hope it gets approved.
Title: Re: [WIP] CLS:: SMF Theme Changer
Post by: NanoSector on March 17, 2012, 05:10:09 PM
Quote from: ClickSafe on March 17, 2012, 02:16:21 PM
Thanks Yoshi2889  ;)
I learned a lot because he also told me to download a few RECENT mods from him.
By reading them, step by step we learned to understand how these Hooks are working.
Give it a try  ::)

The list approvals is quite long, we're going to have some patience
That's great :)
I don't think I like the hook system anyway, though, it being so complicated at first.

My mods also have been in for quite a lot of time. There's two to be approved, and I'm starting to get the feeling that if ONE of your mods doesn't qualify with what SMF wants all of your mods get pushed to the end, which is something I highly disagree with.
Title: Re: [WIP] CLS:: SMF Theme Changer
Post by: Suki on March 17, 2012, 05:13:19 PM
@Yoshi2889  No, every mod is independent and it doesn't matter who  submitted it.

Hooks are very simple to use, the vast majority are just a way to manipulate an array.
Title: Re: [WIP] CLS:: SMF Theme Changer
Post by: Matthew K. on March 18, 2012, 12:29:55 PM
I don't think a lot of people realize what hooks are actually doing, and how. As Suki already said, it's mainly a means to manipulate big arrays without a modification be adding a database row that corresponds to that array.
Title: Re: [WIP] CLS:: SMF Theme Changer
Post by: NanoSector on March 18, 2012, 12:34:14 PM
Guess I'll have to try it out once more, then, and implement it into my mod.

Thanks for explaining.
Title: Re: [WIP] CLS:: SMF Theme Changer
Post by: Matthew K. on March 18, 2012, 12:46:24 PM
I was a fairly firm believer of not using hooks - personally, in my own mods. But eventually, I decided that I might as well try as it eliminates an edit, and I learned how they work in the core, and will never go back to using edits when it's possible to manipulate with a hook.
Title: Re: [WIP] SMF Theme Changer
Post by: NanoSector on March 18, 2012, 01:21:02 PM
Quote from: ClickSafe on March 18, 2012, 12:53:50 PM
With the use of hooks you save a lot of programming time ...
But I do understand that for beginners certainly is a whole study.
Something new ... something strange ... you should ever make time for it ...
I wouldn't call myself a beginner to mods, to be honest. Yet like labradoodle said, it needs time to get used to it.
I'm going to try using them and implementing them in my mods, god let labradoodle be right ;)
Title: Re: [WIP] SMF Theme Changer
Post by: Matthew K. on March 18, 2012, 01:27:03 PM
I'm always right O:) :P
Title: Re: [WIP] SMF Theme Changer
Post by: NanoSector on March 18, 2012, 03:03:50 PM
Quote from: ClickSafe on March 18, 2012, 01:28:35 PM
Quote from: Yoshi2889 on March 18, 2012, 01:21:02 PM
Quote from: ClickSafe on March 18, 2012, 12:53:50 PM
With the use of hooks you save a lot of programming time ...
But I do understand that for beginners certainly is a whole study.
Something new ... something strange ... you should ever make time for it ...
I wouldn't call myself a beginner to mods, to be honest. Yet like labradoodle said, it needs time to get used to it.
I'm going to try using them and implementing them in my mods, god let labradoodle be right ;)
The beginner was not meant for you  ;D just for those people who wants to start writing their first mod ...
I am more a beginner  ;D ;D , just started 2 months ago, with writing my first theme for SMF  ::)
Never really wrote a theme for SMF, it always refuses to install my themes :P
I also hate CSS, but that's another thing.

Looking at my mods at the mod site, some people might think I'm a beginner at making mods. Well, I've wrote FAR more complex mods back on my test site, just haven't got the time and resources to submit them already (they're full of bugs).

Anyway, this is getting pretty off-topic. Back on topic :)