Extension System Discussion #90
Comments
I've been thinking about it for several months, trying to get a solution for a plugin system. I began to scratch something in past December, but I put it aside for a while until I get an efficient solution. Instead "plugins" I called it "extensions", but it's the same idea.
I like the way CakePHP handles extensions (http://book.cakephp.org/3.0/en/plugins.html), but this solution - of course - involves modifying the controllers manually, as it's a framework. In our case all has to be done automatically. As you can see, the PHP side of it is relatively easy to implement: I just load the controller and run it, it'll be accessed just like the default controllers are. New pages will be accessed the same way the others inside Any thoughts? |
I can get behind the php part, as you pointed out it is pretty standard at this point in php development. As for the view, I don't like the javascript way of doing things. I think using javascript can cause a lag if someone is on a slow computer or internet connection. This would cause a lot of flickering, but I be curious to check it out if you put together a demo. I been thinking about this for an 1 hour and really haven't come to my own conclusion of how I would do it. |
I've been thinking about it today... JS is a two-bladed sword: although it's an easy and non-intrusive method to add elements to the default templates without messing up everything, it may flicker the screen and depends a lot of client-side processing. The other way is to add a tag (let's suppose an HTML comment like |
I wouldn't worry about the middleware part since we can just build all HTML to be cached in the database, so it would be generated once. I was thinking about maybe using json to plot out how the page looks? So it could look like...
Then all users would have to do is override the sections that matter to them? I am taking this straight from how magento 1.x does it with xml. Thoughts? |
I would suggest modulizing the templates as much as possible. Instead of using you can use I don't know your code, but I simply start from the html comments in Thread.Index.phtml to explain what I mean. This is the (incomplete, I know) "structure":
In order to build the poll you would have a /templates/default/Thread/Index/Poll.phtml that looks like this
This has the following advantages: DRY: you would be able to create blocks which are usable not only at one place but anywhere. If they afford a different look, that can be done with CSS. Theme-able: instead of simply including the file, you could write a To my understanding that is how templating libraries do it. Although I think in general they are not needed, they make it easier for people to write themes and they help you if you have complex layouts. |
Every good forum software needs to have a plugin system. I am very partial to the event's dispatch type system with new folder theme overriding the default.
What is everyone's favorite way to create a plugin system?
The text was updated successfully, but these errors were encountered: