ZenDB and images

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 8   (RSS)

Hi Jeff, 

Using getRecords() might be the easiest right now, we're working on other options for ZenDB in future.

Or here's a workaround using a CMSB function that gets you an array:

$rows = DB::select('articles')->toArray();
addUploadsToRecords($rows, $baseTable);
showme($rows);

Or converting it back to a SmartArray and using that.

$rows = DB::select('articles')->toArray();
addUploadsToRecords($rows, $baseTable);
$rows = SmartArray::new($rows);

showme($rows);

foreach ($rows as $record) {
    echo "<h1>$record->name</h1>\n";
    foreach ($record->uploads as $upload) {
        echo "<img src='$upload->urlPath'><br>\n";
    }
}

Hope one of those solutions works for you.  

Cheers!

Dave Edis - Senior Developer
interactivetools.com