New idea for the FA framework

I came up with a sweet idea for the FA framework. I'm not sure why it never occurred to me before.

For templates on complicated pages, they inevitably become composites of different components. Each component will either be dynamic or static. Consider the two bars at the top of OneLobby pages. They appear differently depending upon whether or not the user is logged or not. These bars are therefore dynamic.

Currently, the most common approach to dealing with these common components is to create a filter to deal with their initialization (determining the guest's status and showing/hiding certain parts). This is fairly clean, but it is not clear that the filters are related to template components and it is inconvenient to have the filters execute only where necessary. Instead, I'm going to try and create a 'pull' system.

Components will become new 'first class' items in the template engine. Components will have their own controllers and views. They can request their data from all the same models as existing controllers. The major difference that I see as beneficial is that the template engine will be able to load components as necessary and said components' code will be found in clearly defined locations. In this way, the template engine will 'pull' components as necessary.

In writing this post (I havn't written any code yet), it occurred to me that everything is essentially a component with one 'root' parent component. This 'root' component will be the equivalent of the current controllers.

I am not sure how i will implement the component hierarchy or how I will deal with passing data to child components, but it seems to me that this will create a more flexible system for development. My only worry is that for people attempting to understand code using FA, they will have to refer to views to figure out which components are called on a given page.

The primary reason for this new idea is caching. If each component has responsibility over its own view, components can create an opportunity for component-level caching. If one component is merely a static element, or can be given a lifetime, or can be given an expiry condition, then it can be cached and rendered from cache. Logic can be put into base classes to try and propagate caching up the component hierarchy as well.

Anyway, give me some feedback on what you think about these ideas. If you do not know anything about FA (FileArts), I encourage you to take a look at some of k4st's blog posts (

Flyingwithfire

). There is a svn repository that contains it on the net but I'm not sure if k4st wants me to share that.

PS: why do logged-in users have to deal with a kaptcha?

I'll deal with the captcha thing tomorrow.. I'm tired now and have a foam party to go to
Sounds really nice! Go for it!
Well, actually I don't understand that 100%. You mean you create new 'FA template tags' which call some sort of controller which deals again with returning other template files etc. ?!
That's about right. The idea is to localize the controller code for that 'component' somewhere, instead of having it in each action controller that uses it.
Well, actually I don't see the advantage of it, as it just gets somehow a bit more complicated imho. Maybe I don't understand that or it's just me. xD Btw, it would be so cool if you could create a website or some sort of web presence for FA where to get news/updates from. FA really rocks, and an official location to look for official updates and announcements would be really useful. Again, just my honest oppinion.
Something like www.filearts.com ?

?!?!

Is that new?

Yes and no. I own lot's of filearts domains
Looks cool, the logo. So, go for it! =o)
Stuck? Any updates? Please! xD =o)
hmm, innactive already?
Nooooo! Peter's just busy with school! Indeed! ;o)
yeah.. I really need to get back to coding.. LOL
OneLobby
QueryQuery TimeAffected Rows
SELECT o.object_name,o.object_perms,p.perm_grant,p.perm_deny FROM k4_objects o, k4_perms p, k4_roles r, k4_user_roles u WHERE u.user_id=1  AND u.role_id=r.role_id  AND p.role_id=r.role_id  AND o.object_id=p.object_id ORDER BY r.perm_level ASC

 0.649 

 3 

SELECT DISTINCT t.thread_id, t.*, ts.tag_name, GROUP_CONCAT(ts.tag_name SEPARATOR ',') AS tags, u.name AS user_name, uu.name AS edit_user_name FROM k4_thread_tags tt, k4_tags ts, k4_threads t, k4_users u, k4_users uu WHERE t.thread_id=43 AND t.thread_id=tt.thread_id AND ts.tag_id=tt.tag_id AND t.user_id=u.user_id AND t.edit_user_id=uu.user_id GROUP BY t.thread_id LIMIT 1

 0.653 

 1 

UPDATE `k4_threads` SET views=370 WHERE thread_id=43

 0.0008 

 1 

SELECT tu.*, u.name AS user_name FROM k4_thread_users tu, k4_users u WHERE tu.thread_id=43 AND tu.user_id = u.user_id GROUP BY tu.user_id ORDER BY u.name ASC

 0.663 

 1 

SELECT c.*, u.name AS user_name FROM k4_comments c JOIN k4_users u USING( user_id ) WHERE c.thread_id=43 GROUP BY c.comment_id

 0.6687 

 13