문제

I want to list all files in a directory Using PyroCMS.

Using the Files module each client has their own folder, the folder is their User ID

\files\clients\{ID}\  

I need something like this.

 {{ foreach file in { files:/clients/{{ user:id }} } }} 

     <a href="{{files:current_file_name_and_ext}}">{{files:current_file_name}}</a>

{{ endif }}
도움이 되었습니까?

해결책

You should be able to do something like this...

{{ files:listing folder="/files/clients/{{ client_id }}" }}
  <a href="{{ url:site }}files/clients/{{ filename }}">Download {{ name }}</a>
{{ /files:listing }}

You will need to set the client_id variable though. You could set it in your contoller and use:

$this->template
  ->set('client_id', $client_id)
  ->build('page-template-goes-here');

Or even use the current user with the tag:

{{ user:id }}

I haven't tested this, but you should be able to get something going.

From here:

http://docs.pyrocms.com/2.1/manual/index.php/modules-and-tags/tag-reference/files http://docs.pyrocms.com/2.1/manual/index.php/modules-and-tags/tag-reference/user

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top