ZenphotoCMS Forum
Latest images function - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Latest images function (/thread-690.html)



Latest images function - antoxa - 2006-07-23

hello!
i just wrote a simple function for showing latest images. if someone is interested here it is:

put it at the end of zen/functions.php

function show_latest_images($number) {
$sql = "SELECT * FROM ". prefix("images") ." ORDER BY id DESC LIMIT $number";
$result = mysql_query($sql);

echo '';

while($r = mysql_fetch_array($result)) {
    echo '';
    if ($conf['mod_rewrite'] == false) {
        echo ').'&image='.$r['filename'].']';
    } else {
        echo ').'/'.$r['filename'].']';
    }
    echo '';
    echo '';
}
echo '';

}

function get_album_name($id) {
$sql = "SELECT * FROM ". prefix("albums") ." WHERE id = $id";
$result = mysql_query($sql);

while($r = mysql_fetch_array($result)) {
    return $r['folder'];
}

}

when edit your theme and put where you want your images to be
working demo can be found here http://lovart.gektoras.lt/




Latest images function - Jasper - 2006-07-24

hey cool add-on, thanks.