Skip to main content
Topic: SSI recent attachments (Read 2497 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SSI recent attachments

Hi ladies and gents!  I would like to display recent attachments on a home page.  Rather than download links, I would like to display the images themselves, perhaps even linking to the original containing post.  I know enough php to be dangerous.   :D   What would I need to do to make this happen?  Thanks!

Re: SSI recent attachments

Reply #1

Code: [Select]
<?php
require_once('SSI.php');

$attaches = ssi_recentAttachments(10, array(), 'return');

foreach ($attaches as $attach)
{
    echo 'something';
}

The something is stuff you can pick from $attach that is an array containing three indexes: member, file, topic. Each of these contains a bunch of info about the attachment, you can use print_r or var_dump to see the content. ;D
Bugs creator.
Features destroyer.
Template killer.

Re: SSI recent attachments

Reply #2

I'm doing something very wrong.  All I get is the same output as calling ssi_recentAttachments().  Trying to debug, it appears it isn't entering the loop, unless that's wrong too.  lol

Code: [Select]
<?php  
require("SSI.php");

$attaches = ssi_recentAttachments(10, array(), 'return');
$i = 1;
foreach ($attaches as $attach)
{
$i++;
}
echo $i;
?>


This yields the table and 1.  Let's sit back and laugh at my dumb noob mistake.   :D

Re: SSI recent attachments

Reply #3

Darn, it's array....
Code: [Select]
$attaches = ssi_recentAttachments(10, array(), 'array');
Bugs creator.
Features destroyer.
Template killer.

Re: SSI recent attachments

Reply #4

Now why didn't I see that?  It's working perfectly now.  Thanks emanuele! 

Re: SSI recent attachments

Reply #5

Probably for the same reason I didn't see it. xD
You are welcome. ;D
Bugs creator.
Features destroyer.
Template killer.