-
Notifications
You must be signed in to change notification settings - Fork 1
Introduction
xSiteable is a (yet another) PHP framework that tries it hardest to be simple, understandable, extensible, modern and flexible. It encompasses certain paradigms and technologies ;
- event-driven; all class instances and their methods are driven by a structured event-stack, guaranteeing that every part of the framework is extensible, overridable, and fixable.
- Everything is pluggable; all classes hooks into the event-stack as plugins, modules, widgets and actions. If it doesn't plug in, you're doing it wrong.
- fully object-oriented and relying on PHP 5.3+ to make sure we don't spend a lot of time and code on past mistakes
- topic-maps; a semantic technology for easily working with complex structures and meta data, and persistent identification management, and also makes parts of the framework ontology aware
- a variation over the Model-View-Controller paradigm with more intuitive action classes
- REST; embracing HTTP and resource-orientation as a way to leverage flexibility and scalability
- HTML5 using the HTML5 Boilerplate templates as a base
- JQuery and JQuery UI as a base for JavaScripting
- XSLT for the best functional kick-ass templating out there
The framework is fairly light-weight even though it encompasses a fair few concepts, and it does this through putting some of these concepts at the core of the design. Event-driven programming isn't tacked on as an after-thought; it is right there in the middle, guiding both the style and flexibility of development.
For a more direct application design perspective, look at the anatomy of an application. Otherwise, have a look at the conceptual ideas and the design sections which contains many examples, but just to get a feel for it, here's an example of a plugin, a Twitter widget, in its entirety. It uses the Twitter JS framework to appear in a widget window;
class xs_widget_twitter extends xs_Action_Widget {
public $meta = array(
'name' => 'Twitter widget',
'description' => 'Twitter Widget',
'version' => '1.0',
'author' => 'Joe Blow',
'author_link' => 'http://www.bongo.net/',
);
public $properties = array (
'title' => 'CEO Twitter Feed',
'style' => 'min-height:300px;',
'class' => 'color-blue',
) ;
function GET_content () {
return $this->prepare (
'<div style="font-size:0.9em;padding-top:10px;text-align:center">
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2, type: "profile", rpp: 4, interval: 6000, width: "auto", height: 300,
theme: {
shell: { background: "#5c9ccc", color: "#ffffff" },
tweets: { background: "#000000", color: "#ffffff", links: "#4aed05" }
},
features: { scrollbar: false, loop: false, live: false, hashtags: true,
timestamp: true, avatars: false, behavior: "all"
}
}).render().setUser("shelterit").start();
</script></div>'
) ;
}
}
Quick explanation: The $meta properties are handy meta data about the plugin itself, while $properties are properties of the widget itself, in this case its title, how tall it should be as a minimum, and what class to attach to it (in this case, one that controls its color to be blue). The method GET_content() returns widget content on a RESTful GET of the widget controller, and plops it into a widget window. Easy, peasy.