Re: com.xaraya.modules.uploads: Display of property from a xar:data-getitems tag n...

Jason <[email protected]>
Newsgroups gmane.comp.cms.xaraya.devel
Organization Xaraya
Message-ID <[email protected]>
Hb wrote:
> Jason schrieb:
>> I saw your change - was it just down to a rogue '=' instead of an '=='?
> 
> Yes, Chris found it.
> 
>> The old array behaviour should have been the default for backwards
>> compatibility (...). It is probably the wrong way around anyway, as the 
>> xar:data-getitems tag is supposed to return formatted HTML anyway, and not
>> raw data.
> 
> I do not use a xar:data tag in
> http://www.evestorf.de/themes/xcreduced/modules/articles/user-display-aktuelles.xt
> 
> xar:data tags are not described in the RFC 10. How should users know how these
> tags behave? http://www.xaraya.com/documentation/rfcs/rfc0010.html

The documentation is never really clear or easy to find.

The xar:data-output tag invokes the showOutput() method of the property. This is
defined in dynamic data as follows:

    /**
     * Show some default output for this property
     *
     * @param $args['value'] value of the property (default is the current value)
     * @return string containing the HTML (or other) text to output in the BL
template
     */
    function showOutput($args = array())
    {...

Note: it is expected to return HTML, and does that by passing its data to an
output template. The uploads property was not doing that. It was always
returning (and still does) an array of data rather than HTML.

Where in your code you scan over this array and then create HTML from that, the
intended method was to just allow the template linked to the property to do that
formatting for you. The 'template' attribute should then allow you to select a
custom template that formats the image as you like (doing a resize in the
example you have given).

As it stood, there was no way to get the property to return HTML. My fix was
intended to allow a template to be selected, (and I did introduce a bug there
which *forced* a template to be selected - sorry about that, and thanks for
finding it).

The property still returns an array of data, which was intentional to prevent
breaking sites that relied on it, but I still think that is wrong (and the
massive FIXME! from rabbit hints at this too) but there are legacy sites out
there we don't want to break (or maybe we do, with a 'clean slate' restart?).

If you want some further 'documentation' on these tags, the user-display.xd
template of the dyn_example module describes most of them with working examples.
Before that deprecated module gets finally deleted, it would be useful to pull
those worked examples out into a guide.

xar:data-* tags are not described in the RFC because they are not core Block
Layout (BL) tags. They are tags belonging to, and provided by, the dynamicdata
module. The 'data' part of their name is just a short-cut for 'dynamicdata' and
provides some namespace separation from the core BL tags.

Hope that helps.

-- JJ
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.