XF 2.1 XFRM file_hash

Ozzy47

Well-known member
In my addon I have this.
HTML:
                        <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>
                                <dl class="pairs pairs--justified">
                                      <dt>Hash</dt>
                                       <dd>{{ $attachment.getFileHash() }}</dd>
                                  </dl>
                        </xf:if>

But for some reason I can't get the hash to show. I've tried $attachment.getFileHash() $attachment.getFileHash()|file_hash $attachment.file_hash
 
It's a TM to the xfrm_resource_view template.


Find:
HTML:
                        <dl class="pairs pairs--justified">
                            <dt>{{ phrase('views') }}</dt>
                            <dd>{{ max($resource.view_count, $resource.download_count, 1)|number }}</dd>
                        </dl>

Replace:
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>
                                <dl class="pairs pairs--justified">
                                      <dt>Hash</dt>
                                       <dd>{{ $attachment.getFileHash() }}</dd>
                                  </dl>
                        </xf:if>
 
Edit: Ignore the random crap I just talked about earlier.

Should be:
HTML:
$attachment.Data.file_hash
 
Last edited:
It's a TM to the xfrm_resource_view template.


Find:
HTML:
                        <dl class="pairs pairs--justified">
                            <dt>{{ phrase('views') }}</dt>
                            <dd>{{ max($resource.view_count, $resource.download_count, 1)|number }}</dd>
                        </dl>

Replace:
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>
                                <dl class="pairs pairs--justified">
                                      <dt>Hash</dt>
                                       <dd>{{ $attachment.getFileHash() }}</dd>
                                  </dl>
                        </xf:if>

whats is needed for non resource manage attachments to view hash into threads attachments ?
 
Top Bottom