Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-08 14:45:39

schulze
New Member
Registered: 2010-04-05
Posts: 2

txp:file_download_size not working after upgrade

Hi all,

I upgraded my textpattern installation from an old 4.0.4 to 4.2.0. Everything is working, except for the txp:file_download_size tag, which does no longer produce any output.

The file_download_link and file_download_name tags, that I used on the same page, are still working fine. During the upgrade, there were no errors. When switching the textpattern site to debugging, I get a few warnings about deprecated tags, but nothing related to file_download_size.

What could I do to debug this issue? Any hints are welcome.

Thanks,
Jan

Offline

#2 2010-04-08 15:05:29

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: txp:file_download_size not working after upgrade

I can’t reproduce this. The form I’m using is set as follows and works well under Ver 4.2.0. I would check the contents of your form first, default forms may have changed since 4.0.4.

<txp:text item="file" />: 
<txp:file_download_link>
<txp:file_download_name /> [<txp:file_download_size format="auto" decimals="2" />]
</txp:file_download_link>

Offline

#3 2010-04-08 15:50:04

schulze
New Member
Registered: 2010-04-05
Posts: 2

Re: txp:file_download_size not working after upgrade

I am not using a form for the file download. I mostly use the <txp:file_…> tags manually in articles.

This is an example, how I am using it:

<li>Verteile Systeme: <b>RMI, CORBA und SOAP.</b><br /> 
<txp:file_download_link filename="RMI_CORBA_SOAP.pdf">
    <txp:file_download_name /> 
    [<txp:file_download_size format="auto" decimals="1" />]
</txp:file_download_link>
</li>

And this is the resulting HTML code:

<li>Verteile Systeme: <b><span class="caps">RMI</span>, <span class="caps">CORBA</span> und <span class="caps">SOAP</span>.</b><br />
 <a href="http://jan-schulze.de/file_download/19/RMI_CORBA_SOAP.pdf">RMI_CORBA_SOAP.pdf []</a></li>

Maybe I will have to dig into the textpattern code, to find out, how the filesize is calculated …

Offline

#4 2010-04-08 19:32:46

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: txp:file_download_size not working after upgrade

Looking at Textbook "auto" is not a valid option for attribute format. What happens if you either remove it or give it another value?

Last edited by els (2010-04-08 19:33:08)

Offline

#5 2010-04-08 19:33:18

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: txp:file_download_size not working after upgrade

File size is calculated from the number stored in the database at upload (bytes I believe). In view of the fact that the rest of the information contained in the “$thisfile” array is present, I would expect $thisfile[‘size’], which contains this number, to be available as well – calculation is straightforward from there. The tag arrangement you’ve posted looks correct as far as I can tell too.
You might post a tag trace and see if that sheds any light.

Offline

#6 2010-04-08 19:46:00

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: txp:file_download_size not working after upgrade

The default for “format” is now unset, or empty. Using “auto” would be treated by the code as a null or unrecognized value and the code would calculate, best case, internal to the tag automatically. It only returns an empty value if there is no numerical value at all.

Offline

#7 2010-04-08 19:54:06

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: txp:file_download_size not working after upgrade

Thanks Rick, didn’t realize that. I just checked a site where file downloads are in use and I’m using format="auto" there and it just works… Should have checked before I replied, sorry about that.

Offline

#8 2010-04-08 19:58:27

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: txp:file_download_size not working after upgrade

Seems clumsy that “auto” is still in the form. If no file size is returned it looks like “auto” as a present value may be evaluated as true for a format, given that as the case the code would exit from a switch statement as a null value, silently. Very much a valid point to try an active value there.

There are also some comments in file_download_link that describes the point of some housekeeping code that may be a recent addition having to do with whether or not a form is being used. you might try calling a form to see how that behaves as well. I can get the tag arrangement you posted to work fine from an article form, I can’t get this to break the way you’ve described,

Last edited by rsilletti (2010-04-14 19:28:15)

Offline

Board footer

Powered by FluxBB