Welcome Guest, Not a member yet? Register   Sign In
How to best organize module-determined content, which will be different for users
#1

So we're adding paid modules to our site and I'm really not sure what the best way to implement this would be. The modules wouldn't really work as their own controllers since the content will be handled largely by existing controllers with minor changes to content based on if the module is active or not.

I think I see a few ways to go about it:

  1. Minimal use of separate files/class
    +This would involve basically using module access as an if/else statement which would work fine for simpler things like showing a single element or not
    +This would also work well for completely separated content based on access or not, you could call the appropriate function which would handle things differently
    -This would make complex functions that are largely the same with minor differences rather messy I'm thinking. There would be many if else checks weaved into the functions or repeated code is the if else blocks are larger.

  2. Mostly handle things in separate functions, and put as much common code, even if it's like 90%, into smaller functions both methods(active/not active) will call
    +Definitely the easiest to read, as both functions will be calling descriptive function names in between the code that is not common
    -Making changes that get carried through would be tedious since you'd need to alter so many functions?

  3. Move most of the module-dependent code into 'Module libraries', called through $this->supportmodule->showFooterHelpOptions()
    +Clear distinction between code that is universal and code that is dependent on a module being loaded or not
    -Breaks the standard M-V-C convention? The library function responsible for showing the content could still load different views, but would be taking the role of the controller on more complex tasks.
I guess I'm leaning towards #2. I haven't really made anything like this with an MVC setup that wasn't completely separated, where you could access the area or you couldn't, so organization was easy. With things being more interwoven here I'm feeling a little lost.

Any advice would be appreciated, thanks,
Reply


Messages In This Thread
How to best organize module-determined content, which will be different for users - by bmcn - 12-02-2019, 05:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB