Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Makoto Posted February 14, 2020 Posted February 14, 2020 20 hours ago, desti said: sudo, that's right. Without violating the rules, I can only replace \IPS\Notification\Table(...) with \IPS\Db::i()->select(...) and my own template. Why create a framework and prevent it from being used? I think you may be a bit confused though. There's nothing preventing you from using existing templates or calling existing methods and so on, you just can't copy and paste massive amounts of existing core code into your applications and so on. I'd say it's mostly just use common sense. Referencing a few lines in IPS core versus copying and pasting a 100-line method, there's an obvious difference between the two.
desti Posted February 14, 2020 Author Posted February 14, 2020 2 hours ago, Makoto said: I'd say it's mostly just use common sense. Common sense can't be defined by rules. Few lines or big code block - does not matter, rules prohibit this. /cookies/ page - 6 lines, i need sidebar. Override \IPS\Output? Remember how it used to be... Query database, process data, send to template, output. There was no hardcoded definition (well there was almost no) - now they are. \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('cookies_about'); \IPS\Output::i()->sidebar['enabled'] = FALSE; \IPS\Output::i()->bodyClasses[] = 'ipsLayout_minimal'; Why not \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->cookies($sidebar, $class); Template hook would solve all my problems.
desti Posted February 14, 2020 Author Posted February 14, 2020 (I understand this is control for globalTemplate and my example is not entirely correct).
Makoto Posted February 14, 2020 Posted February 14, 2020 10 minutes ago, desti said: Common sense can't be defined by rules. Few lines or big code block - does not matter, rules prohibit this. This has been elaborated on, directly by @Lindy I believe, when this policy was announced. I believe his comment was along the same lines of "just use common sense." Sometimes there is just one way to do things. You're not going to get in trouble for using a few lines of code that exists in the core software. You are going to get in trouble if you just copy and paste an entire 100-line method and maybe try to change just a few lines. This is bad programming practice anyways, for reasons stated above. Widgets all use pretty much the same boilerplate base template. That's fine. That's how it's supposed to work. Not going to get in trouble for this. Extensions all use the same auto-generated base code. That's.. obviously fine, this is intended. Not going to get in trouble for this. It really is just a matter of using common sense. You're making a bigger deal out of this than is necessary.
desti Posted February 14, 2020 Author Posted February 14, 2020 8 minutes ago, Makoto said: Widgets all use pretty much the same boilerplate base template. That's fine. Nope. I need transparent widget, but .ipsWidget (ipsBox) have background-color. Again someone decided for me what the widget should look like.
Makoto Posted February 14, 2020 Posted February 14, 2020 Just now, desti said: Nope. I need transparent widget, but .ipsWidget (ipsBox) have background-color. Again someone decided for me what the widget should look like. Well.. then make a transparent widget. You can add a class to your custom widget to override the styling of ipsWidget however you want.
desti Posted February 14, 2020 Author Posted February 14, 2020 4 minutes ago, Makoto said: you want You don 't understand me again, I want to set out my class, not override someone else's.
Makoto Posted February 14, 2020 Posted February 14, 2020 Just now, desti said: You don 't understand me again, I want to set out my class, not override someone else's. ??? Why does it matter? You're extending in existing framework, this is how that works. You're supposed to adhere to the basic standards of that framework to ensure everything integrates smoothly with the software.
desti Posted February 14, 2020 Author Posted February 14, 2020 Declared as MVC, but... "this is how that works", view defined in model :)
Makoto Posted February 14, 2020 Posted February 14, 2020 Yes, IPS is pretty liberal in terms of being a "true MVC" but it's fleshed out to be a relatively solid framework all things considered. I don't see how that's relevant to the above though?
CodingJungle Posted February 14, 2020 Posted February 14, 2020 7 minutes ago, desti said: Declared as MVC its more PAC than MVC
Makoto Posted February 14, 2020 Posted February 14, 2020 4 minutes ago, CodingJungle said: its more PAC than MVC PAC is a new one for me, but yeah that seems to fit IPS pretty well.
CodingJungle Posted February 14, 2020 Posted February 14, 2020 3 minutes ago, Makoto said: PAC is a new one for me, but yeah that seems to fit IPS pretty well. PAC and HMVC are very similar, IPS could be better described as one of those more than a pure MVC pattern. but the term MVC has been "liberalized" as you say, not just by IPS but by the whole web dev community as a whole, they all have their own approach to it. laravel/symfony are about the closest to the original pattern, but codeignitor/fuelphp/etc all also claim to be MVC, but they are HMVC. I've seen dev's also use MVC interchangeably with OOP too, so the waters are muddy on what a MVC really is anymore :)
desti Posted February 14, 2020 Author Posted February 14, 2020 Only one question, how to change widget background? :) Simple and quick with beautiful code, not nasty set of code hooks.
Makoto Posted February 14, 2020 Posted February 14, 2020 1 minute ago, desti said: Only one question, how to change widget background? 🙂 Simple and quick with beautiful code, not nasty set of code hooks. For all widgets, or just your own? As I mentioned above, you can use CSS to style your own widgets however you want.
desti Posted February 14, 2020 Author Posted February 14, 2020 1 minute ago, Makoto said: or just your own? Yep. 2 minutes ago, Makoto said: you can use CSS to style Parent (and global) div has background-color defined. I need transparent.
Makoto Posted February 14, 2020 Posted February 14, 2020 1 minute ago, desti said: Yep. Parent (and global) div has background-color defined. I need transparent. Add your own class to the widget, create a CSS stylesheet in your plugin to define your own rules for the background color. I don't even think you should need to use !important on the rule since plugin stylesheets are loaded last and will just override the default CSS rules.
desti Posted February 14, 2020 Author Posted February 14, 2020 4 minutes ago, Makoto said: Add your own class to the widget, create a CSS stylesheet in your plugin to define your own rules for the background color. Don't you think it 's too much to change a one CSS property?
Makoto Posted February 14, 2020 Posted February 14, 2020 Just now, desti said: Don't you think it 's too much to change a one CSS property? No. This is just the basic structure of a simple plugin. You'll only need that one CSS file to make any styling changes or additions you need for your entire plugin going forward as well.
bfarber Posted February 14, 2020 Posted February 14, 2020 We have a widget block on our forum index called "Popular Contributors". Let's imagine we want to make it a transparent bg instead of colored. You can do that with just css, no plugin even required. li[data-blockid^="app_core_topContributors"] { background-color: transparent !important; } You can do that just by pasting in the line to your custom.css file. Sometimes you need to get creative and think outside the box a little bit. 🙂
desti Posted February 14, 2020 Author Posted February 14, 2020 bfarber, оk, it's great, but why background has color by default? Set it to transparent, let me set the color in my template! Another question, why do you think the cookie page is always without sidebar and in the _minimal template? This must be my solution (or a skin developer 's solution).
Makoto Posted February 14, 2020 Posted February 14, 2020 Just now, desti said: bfarber, оk, it's great, but why background has color by default? Theming. So theme designers and even clients can customize the style for widgets and such however they like.
desti Posted February 14, 2020 Author Posted February 14, 2020 9 minutes ago, Makoto said: Theming. What will change if we simply move the color definition from .ipsWidget to a widget template? Designers and even clients will not be able customize the style?
desti Posted February 14, 2020 Author Posted February 14, 2020 I don 't really need specific solutions, I only want full freedom within the MVC model, but I constantly see hardcoded limitations and tightly coupling.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.