This is somewhat in the spirit of FieldFrame, but I think focuses on one area which FieldFrame doesn’t. Have you ever wanted a streamlined method of creating new variables and conditionals for your weblog? For example, lets say you needed to display a calculation based on based on values of other fields in your weblog? Lets say you wanted to easily create new conditionals which are dependent on many variables.
As an example, in a personal project, I need to distinguish between 15 minutes before an event begins, between 15 minutes and start time, and after start time. The cleanest way to do this is with conditionals {if before_fifteen}, {if in_session}, but the code behind is pretty ugly.
How about this something like this?
Just create a class:
class Event extends ModelSupport {
public function isBeforeFifteen() {
//some code
}
public function getCountdown() {
//some code here
}
}
Hook this up to your weblog with a configuration file (not in the database, because configuration files are easier), and you’ll get to conditionals {before_fifteen} and {not_before_fifteen} and one variable {countdown} for free!
This of course requires PHP5, because it relies on reflections.
My biggest problem, is that I have no idea what to name it!
If anybody is interested in this, or has some other ideas, please let me know and i’ll make it available (right now it is in a pre-alpha stage…I’m working on features as I need them for a current project).
I also have other plugins that I might make available such as a “master template” plugin to facilitate keeping a common layout throughout your templates, in a DRY fashion, using the “two-step” view pattern.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.