Dùng để lấy danh sách thư viện ra một khu vực bất kỳ
Hàm demo :
get_list_gallery($limit, $category_id, $onlyShowPublished, $orderBy, $locale);
Trong đó:
$limitgiới hạn thư viện cần lấy ra, mặc định là 10.$category_idlấy thư viện theo danh mục ID, mặc định là 0 sẽ lấy không theo danh mục.$onlyShowPublishedchỉ hiện các bài đã được đăng tải, mặc định làtrue.$orderBysắp xếp danh sách thư viện theo bên dưới mặc định làlatestlatestmới nhấtoldestcũ nhấtpopularthư viện xem nhiềufeaturethư viện nổi bật
$localengôn ngữ cố định, mặc định lànullsẽ lấy theo ngôn ngữ trang.
Kết quả trả về là một collection và mỗi phần tử là một đối tượng Gallery.
Ví dụ: lấy 10 thư viện mới nhất thuộc danh mục có ID = 5 sẽ viết như sau:
@foreach(get_list_gallery(10, 5) as $gallery)
<article class="gallery">
<a class="gallery-thumb hover-cycle" href="{{ $gallery->language('link') }}">
@if($gallery->thumbnail)
<img src="{{ $gallery->thumbnail }}" alt="{{ $gallery->language('name') }}">
@endif
</a>
<div class="gallery-info">
<h3 class="gallery-title">
<a href="{{ $gallery->language('link') }}">{{ $gallery->language('name') }}</a>
</h3>
<ul class="gallery-meta">
<li><i class="ti ti-folder"></i> {!! implode(', ', $gallery->list_categories) !!}</li>
<li><i class="ti ti-eye"></i> {{ number_format($gallery->view->count) }}</li>
</ul>
<p class="gallery-desc">{{ $gallery->language('description') }}</p>
</div>
</article>
@endforeach
