<mySearch ⁄>
<myBlog show="last" ⁄>
<myPhoto order="random" ⁄>
<mySnippets order="rand" ⁄>
<mySnippets type="lang" ⁄>
<myQuote order="random" ⁄>A leveza triunfa da dureza; a fraqueza, da força.
<myContacts ⁄><email ⁄>
<windows live messenger ⁄>
<myCurriculum type="pdf" ⁄>
<myVisitorsMap ⁄>Most of the people I have the pleasure to know and work with, all of them excellent PHP developers, old colleges and friends, don't know about this amazing pattern: The Intercepting Filter.
Seems that this pattern is not commonly used at all in the PHP world for any reason. However, it's one of the most powerful pieces within a framework.
So, give me 5 minutes to just introduce you to this pattern.
Imagine common tasks bound to every request in your site, tasks like to switch to a given language or currency, or even to authenticate your users via a cookie.
We must provide our application in order to intercept some information within the request in order to execute a task or the other one.
One of the most common way to do that in PHP, but not the most elegant at all, is to include one or more scripts in every page on our site in charge of parse the request and execute some tasks.
In fact, it's really common to see a kind of common.php script that every page includes in. Not so maintainable, but very practical, right?
este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:
http://www.lionframework.org/blog/2009/09/the-power-of-the-interceptin...
<myNews show="rand" cat="programacao" ⁄>