[OzzModz] XFRM File Extension And Size Display

[OzzModz] XFRM File Extension And Size Display 1.0.1

No permission to download

ozzy47

Well-known member
ozzy47 submitted a new resource:

[OzzModz] XFRM File Extension And Size Display - Show extension type and file size

Another addon brought to you by:
View attachment 203315

This is a simple addon that will show the file extension type and file size in the resource view page. There are no settings for the addon, just install it and forget it.

What it looks like:
View attachment 203316

This addon is also available on my site, https://ozzmodz.com/resources/ozzmodz-xfrm-file-extension-and-size-display.13/
Read more about this resource...
 

stunod29

Member
Thanks for the great add on... I've been looking for something like this for awhile now!
 
Last edited:

ozzy47

Well-known member
I don’t think that has anything to do with this addon. Uninstall it and verify please.
 

kick

Active member
Great modification ... Why do we need to cycle twice in all of this? Why do we need a cycle here? It seems to be a simple addition, but not advisable use of cycles as well as the use of resources. Why did the developers add the possibility of their variables?
HTML:
<dl class="pairs pairs--justified">
                            <xf:if is="count($resource.CurrentVersion.Attachments) == 1">
                                <xf:foreach loop="$resource.CurrentVersion.Attachments" value="$attachment">
                                    <dt>{{ phrase('extensionsize_extention_type') }}</dt>
                                    <dd>{{ $attachment.getExtension() }}</dd>
                                </xf:foreach>
                            </xf:if>
                        </dl>
                        <dl class="pairs pairs--justified">
                            <xf:if is="count($resource.CurrentVersion.Attachments) == 1">
                                <xf:foreach loop="$resource.CurrentVersion.Attachments" value="$attachment">
                                    <dt>{{ phrase('extensionsize_file_size') }}</dt>
                                    <dd>{{ $attachment.getFileSize()|file_size }}</dd>
                                </xf:foreach>
                            </xf:if>
                        </dl>]
It seems to be all simple and quite logical decision, but this is not even knowledge of the syntax of XenForo. Give me a moment to think and oh can you do this
HTML:
$0
<xf:if is="count($resource.CurrentVersion.Attachments) == 1">
  <xf:set var="$attachment" value="{{ $resource.CurrentVersion.Attachments|first }}" />
  <dl class="pairs pairs--justified">
      <dt>{{ phrase('extensionsize_extention_type') }}</dt>
      <dd>{{ $attachment.getExtension() }}</dd>
  </dl>
  <dl class="pairs pairs--justified">
      <dt>{{ phrase('extensionsize_file_size') }}</dt>
       <dd>{{ $attachment.getFileSize()|file_size }}</dd>
  </dl>
</xf:if>
And where are the arrays? Where is busting them. In addition to all this, we write code according to the DRY development principle. In what form we now see all this, we get a waste of resources to nowhere and 2 times through the cycle 1 time to get the type, and the second time to get the size of the file itself. Where exactly in the search of these elements there will be the same result, only with a higher expenditure on memory consumption.

 
Last edited:

ozzy47

Well-known member
Thanks for reporting this. I will look into it and update if necessary.

Great modification ... Why do we need to cycle twice in all of this? Why do we need a cycle here? It seems to be a simple addition, but not advisable use of cycles as well as the use of resources. Why did the developers add the possibility of their variables?
HTML:
<dl class="pairs pairs--justified">
                            <xf:if is="count($resource.CurrentVersion.Attachments) == 1">
                                <xf:foreach loop="$resource.CurrentVersion.Attachments" value="$attachment">
                                    <dt>{{ phrase('extensionsize_extention_type') }}</dt>
                                    <dd>{{ $attachment.getExtension() }}</dd>
                                </xf:foreach>
                            </xf:if>
                        </dl>
                        <dl class="pairs pairs--justified">
                            <xf:if is="count($resource.CurrentVersion.Attachments) == 1">
                                <xf:foreach loop="$resource.CurrentVersion.Attachments" value="$attachment">
                                    <dt>{{ phrase('extensionsize_file_size') }}</dt>
                                    <dd>{{ $attachment.getFileSize()|file_size }}</dd>
                                </xf:foreach>
                            </xf:if>
                        </dl>]
It seems to be all simple and quite logical decision, but this is not even knowledge of the syntax of XenForo. Give me a moment to think and oh can you do this
HTML:
$0
<xf:if is="count($resource.CurrentVersion.Attachments) == 1">
  <xf:set var="$attachment" value="{{ $resource.CurrentVersion.Attachments|first }}" />
  <dl class="pairs pairs--justified">
      <dt>{{ phrase('extensionsize_extention_type') }}</dt>
      <dd>{{ $attachment.getExtension() }}</dd>
  </dl>
  <dl class="pairs pairs--justified">
      <dt>{{ phrase('extensionsize_file_size') }}</dt>
       <dd>{{ $attachment.getFileSize()|file_size }}</dd>
  </dl>
</xf:if>
And where are the arrays? Where is busting them. In addition to all this, we write code according to the DRY development principle. In what form we now see all this, we get a waste of resources to nowhere and 2 times through the cycle 1 time to get the type, and the second time to get the size of the file itself. Where exactly in the search of these elements there will be the same result, only with a higher expenditure on memory consumption.
 
Last edited:
Top