[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [phpGroupWare-developers] Re: RE: Re: Setup broken?
From: |
Sigurd Nes |
Subject: |
Re: [phpGroupWare-developers] Re: RE: Re: Setup broken? |
Date: |
Tue, 26 Jan 2010 18:19:19 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
Lars wrote:
Could someone briefly explain, how the templates work and how translations are
thought to be added? Thanks!
There are three type of templates (if one count the YUI):
1) PHPLIB // oldest
Maybe someone else can describe this one...
Or pick a simple app (as 'todo') to see how it is used
2) XSLT // newer
Applications like admin, notes, property, hrm uses the XSLT-approach
the principle:
you load a XSLT-template into the template-engine and then follow up with an
array.
the array is auto-converted to XML and the template is applied on the XML for
rendering.
see xslttemplates::parse for details
example:
// start
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true; // Has to be set to render
xslt
$GLOBALS['phpgw']->xslttpl->add_file(array('some_stylesheet', 'and_another'));
$data = array('data generated from your ui-object');
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data)); //'list' is
where to start inside the template
// end
Translations can be called directly from the template as:
<xsl:value-of select="php:function('lang', 'translate me')" />
Note: the xmlns has to be defined - example from admin:
<xsl:template match="group_edit" xmlns:php="http://php.net/xsl">
I recommend having a look at notes and (some of) admin to see XSLT in action.
Note: the amount of translation code is down 50% from what you see in notes
3) YUI library // latest
Property uses YUI on top of the XSLT for tables, pagination, filters
The booking and bookingfrontend (which is soon to be published) use a smarter
combination of XSLT/YUI with a common ui-class and drop-in YUI-widgets
Regards
Sigurd