Quote:
Originally Posted by Toby
Your code as written pulls 25 galleries sorted by Date Approved, descending... so most recently approved first. The galleries will appear in the order they were approved. The random, as written, is ignored on a Build With New.
If I'm understanding what you want... you need two sections. First section pulls a specified number of new galleries, order = Date_Approved Desc.
Second section pulls remaining galleries order = Rand()
If you want yesterday's new galleries to just scroll down as more new are added, set the second section to order = Date_Displayed DESC
In all cases set reorder to match order.
|
As I read this, one thing struck me as odd: We want to 1st load any & all new galleries when we Build With New, followed by random galleries to fill out the rest of the area (in my example, 25 total galleries) But your method says we have to pull "a specified number of new galleries". These are for category pages, so before each Build With New, we'd have to figure out how many new galleries we have for each of the 55 category pages & adjust the code based on how many new galleries we'd have (if any). That seems really time consuming, so I looked in the
documentation
which is where I found this:
So THAT'S what I need
To save everyone that's following along at home from having to go find that filler_galleries.txt example template to see what it does, I've included it below
Code:
Overview
--------
This template shows how to use the fillvar option of the {galleries} function.
The first galleries section will attempt to load 20 submitted galleries. If there are not
20 submitted galleries available, the second {galleries} function will come into play and will
try to pull enough permanent galleries so that you will have 20 total loaded.
So, for example, if the first {galleries} section pulls 8 galleries, the second {galleries}
section that has the fillvar option set will try to pull 12 more so you have a total of 20.
Template Code
-------------
{define name=globaldupes value=true}
{define name=pagedupes value=false}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TGP</title>
<style type="text/css">
body { font-size: 12px; font-family: Verdana; }
td { font-size: 12px; font-family: Verdana; }
.jmbfoot { font-size: 8pt; font-family: Verdana; text-align: center; }
.jmblink { font-size: 8pt; font-family: Verdana; }
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center">
<span style="font-size: 20pt; font-weight: bold;">TGP</span><br />
Links to {$total_thumbnails|tnumber_format} free pictures and movies!<br />
Updated {date value='today' format='m-d-Y'}
</div>
<br />
<table align="center" cellpadding="5" border="0">
<tr>
{* Load 20 galleries *}
{galleries
var=$galleries
preview=true
type=submitted
category=MIXED
amount=20
getnew=true
allowused=true
order=date_approved
reorder=date_displayed DESC, date_approved}
{* Load filler galleries if 20 galleries were not available in the previous galleries section *}
{galleries
var=$fillergalleries
fillvar=$galleries
preview=true
type=permanent
category=MIXED
amount=20
getnew=true
allowused=true
order=date_approved
reorder=date_displayed DESC, date_approved}
{* Place the filler galleries at the end *}
{intermix var=$galleries from=$galleries,$fillergalleries location=end}
{* Display loaded galleries as thumbnails in a 5 per row format *}
{foreach from=$galleries var=$gallery counter=$counter}
<td><a href="{$gallery.gallery_url|htmlspecialchars}" target="_blank"><img src="{$gallery.preview_url|htmlspecialchars}" border="0" alt="Thumb {$gallery.type|htmlspecialchars}"></a></td>
{insert location=+5 counter=$counter max=15}
</tr><tr>
{/insert}
{/foreach}
</tr>
</table>
<br />
<div align="center">
<b><a href="{$config.install_url}/submit.php">Submit A Gallery</a></b>
</div>
<br />
</body>
</html>