Docs › Framework Reference – Overview

Diagram of a standard request

This page shows how a standard request to Piwik is handled, how is the Model View Controller used, when is called the API, etc.

This diagram show what happens for a request to piwik, for example an ajax request with the URL http://demo.piwik.org/index.php?module=Referers&action=getKeywords&idSite=1&period=day&date=yesterday&viewDataTable=cloud

source:/trunk/misc/diagram_general_request.jpg

Explanations

When hitting this URL the following things will happen:

  • index.php the index.php calls to the FrontController. After initialization, the Front Controller will dispatch the request to the appropriate Controller. This controller is always located in a plugin specified by the module parameter. In our case this controller is the Referers Controller
  • Referers_Controller the Controller Referers is loaded, and the method getKeywords() is executed (specified by the action parameter). This method getKeywords() will:
    • load a ViewDataTable object via the factory() method. The factory will look at the viewDataTable parameter in the HTTP request and load the appropriate ViewDataTable object ; in our case it will load the ViewDataTable_Cloud.
    • init() the ViewDataTable_Cloud object, by giving it some useful parameters ; for example, the API method to call to request the data
    • call the renderView() method on the ViewDataTable object
  • ViewDataTable_Cloud the renderView() method on the ViewDataTable will call the main() and then render() the view. The main() will load data from the API and get a DataTable object. It will convert this DataTable in a simple PHP array and give this array to the Visualization_Cloud object (which is a simple class to render a tag cloud given an array of (keyword,value)
  • Visualization_Cloud the Visualization_Cloud will go through the array( keywordA => value, keywordB => value, ... ) and render the tag cloud as HTML using the appropriate template (cloud.tpl) – the templating system used is Smarty.
  • cloud.tpl / smarty The HTML generated is then given back to the ViewDataTable, then the Controller, the FrontController, and finally to the user.
  • After the browser receives the HTML, all the javascript code (if any) will be executed (for example all the Jquery code).

You may also be interested in...

Documentation feedback

Have you found an error in this page, or do you think some information is missing or not clear?
Your comments, suggestions, and ideas for improvements to this documentation are very important to us. We appreciate you taking the time to send us this information.



Keywords used to find this page: piwik framework, site:piwik.org framework


This list top keywords was displayed using a Piwik Widget "Top Keywords Widget". You can access it in your Piwik: click on Widgets, and look under the Referrers category.

Entries (RSS)