Display Upload Files - DragSortOrder

5 posts by 2 authors in: Forums > CMS Builder
Last Post: January 25, 2012   (RSS)

I have a multi-record section that includes an "upload" field. Each record typically includes 10 to 12 upload files.

I would like to be able to display on my webpage, the top uploaded file from the topmost record.

For example, if I have the following data:
Record 1
- file 1
- file 2
- file 3
Record 2
- file 1
- file 2

I want to only display Record 1 File 1.

Any ideas how I would attack this problem?

Ragi
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Display Upload Files - DragSortOrder

By Jason - January 24, 2012

Hi Ragi,

So what you need to do is start by only getting the first record from your record set:

example:

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
));

$newsRecord = @$newsRecords[0]; //retrieve the first record from the record set


Next, if you were able to get a record, attempt to get the first upload from that record.

example:

<?php if (@$newsRecord['uploads']); ?>
<?php $upload = $newsRecord['upload'][0]; // get first upload ?>

// output $upload here

<?php endif ?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [northernpenguin] Display Upload Files - DragSortOrder

By Jason - January 25, 2012

Hi,

Do you have multiple records outputting, or the same upload showing up more than once? If it's the latter, try removing your nested foreach look like this:

<?php foreach ($albatrossRecords as $record): ?>

<?php if ($record['file_upload']): ?>
<?php $upload = $record['file_upload'][0]; // get first upload ?>

Latest Issue: <a href="<?php echo $upload['urlPath'] ?>"><?php echo $upload['info1'] ?></a>

<?php endif ?>

<?php endforeach ?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Display Upload Files - DragSortOrder

That's great Jason! Thank you, it worked perfectly.
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke