Bytes to better terms?

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Bytes to better terms?

Postby harmlessgoat22 » 15 Jul 2008, 14:53

I'm wondering how I can take the 'filesize' column from the attachments table, and make it not show Bytes, but show better terms, considering size, eg 446.51 KiB instead of 457222 Bytes. First of all, I looked into phpBB3's code, and I can't figure out how they do it. Second of all, I don't know what function I need, or whatever. Thanks!

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
Mighty Gorgon
New member
New member
Posts: 44
Joined: 25 Jul 2007, 12:34
Real name: Luca
Location: Italy
Contact:

Re: Bytes to better terms?

Postby Mighty Gorgon » 15 Jul 2008, 22:07

Luca

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: Bytes to better terms?

Postby harmlessgoat22 » 16 Jul 2008, 01:39


That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bytes to better terms?

Postby igorw » 17 Jul 2008, 11:21


- we're poor!

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: Bytes to better terms?

Postby harmlessgoat22 » 17 Jul 2008, 15:37

Wait? I don't understand...?

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bytes to better terms?

Postby igorw » 17 Jul 2008, 16:02

Instead of adding false as second argument you just let it default to true, then you don't have to add the $filesize checks because they are performed by the function itself. :)

- we're poor!

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: Bytes to better terms?

Postby harmlessgoat22 » 17 Jul 2008, 17:01


That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Bytes to better terms?

Postby igorw » 17 Jul 2008, 17:03

Yep :) Take a look at the function in includes/functions.php yourself :P

- we're poor!

User avatar
Mighty Gorgon
New member
New member
Posts: 44
Joined: 25 Jul 2007, 12:34
Real name: Luca
Location: Italy
Contact:

Re: Bytes to better terms?

Postby Mighty Gorgon » 21 Jul 2008, 13:51

Luca


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “phpBB Development discussion”

Who is online

Users browsing this forum: No registered users and 31 guests