Files


$file Properties

$file->url

Introduced in Version 2.0

Description

URL to the file on the server

Let's say you want to show list of files and their download links. You have file field called "files". Your code for list would look like this:

‚Äčif ($page->files->count()) {
  echo "<ul>";
  foreach($page->files as $file) {
    echo "<li><a href='$file->url'>$file->filename</a></li>";
  }
  echo "</ul>";
}																													

Related

Post Comment