wCMF Wiki : ProgrammingViews

HomePage :: Categories :: PageIndex :: RecentChanges :: Login/Register
Views are implemented as HTML pages (defined in the view templates), which typically contain a form, which displays the data to be modified. For programming dynamic parts and to access application data the Smarty template language is used.
By default the views are stored as .tpl files in the directory /application/inlcude/views (see smarty). In the directory /wcmf/application/views those views are stored, which the framework uses for its standard application. These are the basis for the programming of custom views.

In the view templates all data, which was passed to the view instance is accessible (see ProgrammingControllers). In the simplest case these can be displayed via {$variable}. In addition object data can be accessed by using {$object->getValue(...)}. By setting debugView = 1 (see cms) in the ConfigurationFile Smarty will display the data, which is available in the template, in an external window.

The data displayed in the view's form is available to the following controller. Some (hidden) input fields should always exist. They are defined in the file /wcmf/application/views/formheader.tpl, which - to simplify matters - should be reused.
For handling the form data some JavaScript functions are provided (and documented) in the file /wcmf/blank/script/common.js.

In the directory /wcmf/lib/presentation/smarty_plugins the framework defines extensions of the Smarty template language:

* Function translate for localization of strings
e.g.: {translate text="Logged in as 1% since 2" r0="$login" r1="$logindate"}
* Function SessionValue to get a session variable
e.g.: {sessionvalue name="platform"}
* Resource lib to integrate templates with a relative path to the framework's root directory (/wcmf)
e.g.: {include file="lib:application/views/formheader.tpl"}
...
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0334 seconds