Last active
May 19, 2019 09:57
-
-
Save Titoratus/2af9af74eff3322c8c2eafdb7a31fd1c to your computer and use it in GitHub Desktop.
Вывод картинок record'а на обычной странице
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Модель::all()->last()->vlk_file->getPath(); | |
Другой вариант: | |
// Это в обычной функции | |
$images = array(); | |
// $records равен запросу в бд с выборкой чего-либо | |
foreach($records as $index => $record) | |
$images[$index] = \System\Models\File::where('attachment_id', $record->id)->get(); | |
$this['images'] = $images; | |
// Теперь выводим через Twig | |
{% set ind = loop.index - 1 %} | |
{% for image in images[ind] %} | |
<a href="{{ image.getPath() }}"><img src="{{ image.thumb(200, auto) }}" alt=""></a> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment