In this section, you will edit the default.php page of the gallery in order to make it display, below the random image, the thumbnails of the 5 most recently uploaded images.
In order to retrieve only the latest 5 images, create a recordset A recordset is the result of executing an SQL query A query is a SQL command that will extract information from the tables of a database. Essentially, a query is a request for information from your database.. It is composed of multiple rows, each row having multiple columns. The columns presented in the query result depend on the column list declared in the query (they can belong to different tables). The number of rows and their order depend on the query conditions (WHERE, GROUP BY, HAVING, ORDER). The recordset acts as a source of dynamic data The InterAKT Dynamic Data tool is a replacement for the standard dynamic data dialog. It is used in the MX Kollection 3, to provide a unified way of building mark-ups, or place holders. These are recordset fields, server or session variables, and other types of dynamic data that are replaced at runtime by their corresponding values in web applications. (rsLastImg) that uses the following SQL code (use the Advanced view):
SELECT id_img, idalb_img, filename_img, date_img
FROM image_img
ORDER BY date_img DESC LIMIT 0,5
If you are using ColdFusion, use the following code (no matter the database type):
SELECT id_img, idalb_img, filename_img, date_img
FROM image_img
ORDER BY date_img DESC
and then edit the <cfoutput> tag to make it look like this: <cfoutput query="rsImages" maxrows="5">
If you are using Microsoft Access, you can create the recordset with the following code:
SELECT TOP 5 id_img, idalb_img, filename_img, date_img
FROM image_img
ORDER BY date_img DESC
Create a new paragraph below the Repeat Region already existing on the page.
Apply a Show thumbnail server behavior A server behavior is a reusable component for server-side development. They add blocks of code to your pages for accomplishing specific tasks. Dreamweaver comes with several default server behaviors and the InterAKT extensions add many more to this list. configured to use the rsLastImg recordset to retrieve the file name.
Apply the Looper Wizard from the MX Kollection tab of the Insert panel and configure it as follows:
· In the Recordset drop-down menu select rsLastImg.
· Select the All records radio-button. This will disable the number of Rows setting, leaving only the number of Columns available for modification. Since the recordset only retrieves 5 records, and the best way to display them is in a row, enter 5 for the number of columns to use with the Horizontal Looper.
· Hit Finish to close the dialog box.
Next you have to turn each image into a link that will display the image at its actual size. To do so, select the image, and through the Make Link interface, select the full_view page, passing it the id_img URL parameter.
Save the page and upload it to the server. It should be similar to this one: