Hi, I was searching the web for a framework to build my new project and found Phalcon which seems to be really interesting. I started to read its documentation, trying samples and build little applications to learn how it works.
But, there is one more thing I'd like to do before using Phalcon. I need HTML5 history to work on my application. This means that I'd like to show HTML or JSON depending on http headers. And I'd like to avoid creating the 3 same lines of code in every action.
For example : I go to : https://domain.com/search/query/this+is+a+test -> Call SearchController::queryAction() and send HTML response I go to : https://domain.com/search/index, fill the form query and click "Search", jquery ajax call https://domain.com/search/query/this+is+a+test using ajax http header and get the response which would contain for example :
{
"title" : "this is a test",
"body" : "<div>[...]</div>"
"url" : "https://domain.com/search/index"
}
And use pushstate.
The problem is that I need this kind of double response type for almost all my controller (if not all of them).
Thanks, cylessia