Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 2.0 - A defense of plugins
#1

[eluser]Crimp[/eluser]
I am not sure the removal of Plugins in favor of Helpers is very helpful. Here's how I use the two:

1. Plugins

Examples of Plugins I often use are DOMPdf and HTMLPurifier. I place the nested project folder in the system-level Plugins and, that's right, plug a massive project into CI to extend it with a functionality akin to that offered by core CI classes.

2. Helpers

I use helpers just like CI intended. Typically just a few functions in a single file. Typically used for custom formatting in and across views. A recent example would be a forum_helper with time returned in plain language and search words highlighted, both helpful formatting functions repeated in views.

Now, these are two entirely different things in my mind. Even if a call to htmlpurify() may be construed as a one-trick pony, and thus no more or less than a helper, it comes with enough amazing and speedy baggage to make that pony employee of the month at the Pony Express.

Remember, also, that Plugins like HTMLPurifier even have their own internal cache (optional, ok, but a def. pluss). While it does not really matter what we call things and where we place them, as long as we can make them work, there is a logic and usefulness to working with meaningful structures - exemplified by familiar things like MVC.

Plugins made some sense. Now that sense is lost in the increased clutter of Helpers.

I am not offering my 2 cents for their return here. But I feel that the differences are worth thinking about.
#2

[eluser]Phil Sturgeon[/eluser]
I am glad to see the back of plugins as they were not all that different from helpers and just confused new users. With the word plugin being used so often to mean something like "widgets" or "template parser blocks" this was getting even more confusing when trying to make any sort of open-source project.

Is there a problem with just putting them in a helper file? Now a helper can be a list of functions or a function with a class. No reason to distinguish between the two really.

Wrap with function_exists() or class_exists() and you can even override helper classes.
#3

[eluser]Crimp[/eluser]
My point, and the difference, relates primarily to the "weight" of dependencies and thus meaningful organization of CI. I know how to make it work either way. That's not the issue.

A Helper with an internal cache at the same order as get_clickable_smileys()? Your eyebrow is not raised, a little?
#4

[eluser]Phil Sturgeon[/eluser]
That would raise my eyebrow whether it was a helper or a plugin. That to me may well be better off as a Smiley library. Or a helper function that calls a Cache library.
#5

[eluser]Crimp[/eluser]
I'll clarify:

When I refer to an internal cache, I talk specifically about HTMLPurifier to exemplify that some of today's plugins are far removed from the helpers. It is obviously not practical, and utterly pointless, to start caching its deifnitions elsewhere because with such a plugin you, well, plug and play. Those are the key words.

This organizational aspect of development with CI seems to have been forgotten in the process of cleaning up the folder hierarchy.




Theme © iAndrew 2016 - Forum software by © MyBB