Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: fieldname:length format

Status Resolved
Add-on / Version Reel
Severity Trivial
EE Version

Michael Kelleher

Oct 27, 2012

Is there any easy way of formatting the time returned in mins and seconds? Been looking into this for the last hour with no luck. Any help would be appreciated.

 

#1

BoldMinded (Brian)

The times returned are unix timestamps, so you should be able to use the native EE format parameter, e.g. {time format=”%s”}

#2

Michael Kelleher

I’ve tried {fieldname:length format=”%I %s”} but it returns only a second value. Combing through the forums at the moment for something similar. Thanks for the prompt reply.

#3

BoldMinded (Brian)

What is the value of :length without the format parameter?

#4

Michael Kelleher

{fieldname:length format=”%I %s”} and {fieldname:length} both return the same value (in seconds).

#5

BoldMinded (Brian)

Michael, can you post a URL where this is happening? Would you be able to put both variables in the page so I can see the output of both, e.g.

{fieldname:length} {fieldname:length format=”%l %s”}

#6

Brian Litzinger

MIchael, have you figured this out yet?

#7

Michael Kelleher

Brian,

I send you a CP login last week. Did you get a chance to look at this?

#8

BoldMinded (Brian)

I did not, sorry. It dropped off my radar. Will look at it this week.

#9

Michael Kelleher

Thanks Brian.

While you are looking. My client is having issues adding vimeo videos. They can add youtube ones without a problem. I can’t replicate the problem on this end. Same os (Mountain Lion) and browser (firefox 10.74). Running Wyvern Video 1.2.2 and EE 2.52. Only difference is I’m logged in as superadmin and they’re admin. Can’t see this as an issue however as they can submit youtube videos. Any ideas?

#10

BoldMinded (Brian)

My first guess would be to look at the console if possible to see if there are any javascript errors.

#11

BoldMinded (Brian)

As for the formatting, I’ll have a fix sent to you soon.

#12

Michael Kelleher

Thanks Brian,

Time formatting working fine now. I’ll open another thread on the vimeo issue just for clarity.

#13

Michael Kelleher

Brian,

I think I’ve come across a further bug with getting the time format output. I needed to include the WYVERN video as part of a ‘cartthrob package’. If I try to include the time formatting within the cartthrob package tag pair the formatted video length outputs nothing.

e.g. {cartthrob_package} Duration: {fieldname:length format=’%i’}mins {fieldname:length format=’%s’}secs {/cartthrob_package}

The strange thing is an unformatted time stamp is output if I remove the format tag or if I call an unformatted time stamp first the formatted version will output after without a problem

e.g.

Duration: {fieldname:length} {fieldname:length format=’%i’}mins {fieldname:length format=’%s’}secs

Again any help is appreciated.

#14

BoldMinded (Brian)

The same temate code works fine outside of the cartthrob tag pair though? Did you try formatting the current_time variable inside the cartthrob pair to see I’d the format param works?

#15

Michael Kelleher

Inputting {current_time format=’%i’} returns current minutes formatted correctly.

The same template code works in other templates. The cartthrob tag pair is some kind of relationship field specific to cartthrob packages (http://cartthrob.com/docs/fieldtypes/packages/index.html)

Pulling in {fieldname:length} unformatted works fine in the tag pair as does {fieldname:thumbnail_large}

Currently as a workaround I’m calling in {fieldname:length} wrapped in a span and hiding with css. Not ideal but it is helping {fieldname:length format=ā€™%iā€™}mins {fieldname:length format=ā€™%sā€™}secs to get the correct values somehow.

#16

BoldMinded (Brian)

Michael, would you be able to edit this ticket and add FTP access in the fields provided? Only I will see them. Otherwise I’m going to have to spend a couple of hours just configuring Cartthrob to replicate this.

#17

BoldMinded (Brian)

Took this offline to email, and I think its working now? If not, please open a new ticket, or just update me in the email thread. Thanks.

Login to reply