'Where' to find an answer!

18 posts by 4 authors in: Forums > CMS Builder
Last Post: October 23, 2008   (RSS)

By Perchpole - July 5, 2008

DAve -

Amazing. You've cracked it yet again!

This is the code I'm using to display the the uploads and associated data:

<?php foreach ($uploadRecords as $record): ?>
<a href="<?php echo $product[/#ff0000]['_link'] ?>"><IMG SRC="<?php echo $record[/#ff0000]['thumbUrlPath'] ?>" />
<BR />
<?php echo $product[/#ff0000]['title'] ?></a>
<?php endforeach ?>


The only thing you need to remember is to put the right placeholders[/#ff0000] in the right places - otherwise things get a bit muddled!

Just one final request on this topic: could you conjure-up a version of your code using the modern CMSB format, please?

:0)

Perch

By Perchpole - July 8, 2008

Hi, Dave (and Jake) -

Thanks for your help with this matter. I've used both versions of the code to create random image pages - and both work very well.

However, there is one small issue which is rather interesting...

The code works by pulling images from the Uploads table. Trouble is, this includes images which belong to records that have been deleted! I checked the Upload table via phpmyadmin and, sure enough, all the images I've uploaded are still present.

As a work around I've added some more code to the Uploads' "where" condition - which seems to do the trick.

It's not really an issue but it is interesting to learn that the Uploads stay around even when the records associated with them have been erased!

Thanks, again, for your help.

:0)

Perch

Re: [Perchpole] 'Where' to find an answer!

By Dave - July 8, 2008

Hi perch,

Thanks for reporting that. Uploads should be erased with records in all cases. I'll do some tests on that locally and fix it for the next version if needed.
Dave Edis - Senior Developer
interactivetools.com
I have this:

<?php

require_once "/home/content/d/e/r/derekseal/html/utahreoexperts/cmsAdmin/lib/viewer_functions.php";

// load upload
list($uploadRecords, $uploadMetaData) = getRecords(array(
'tableName' => 'uploads',
'where' => 'tableName = "videos" && fieldName = "video"',
'orderBy' => 'RAND()',
'limit' => '1',
));
$upload = @$uploadRecords[0]; // get first record

// load record
$recordNum = @$upload['recordNum'];
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
'where' => "num = '$recordNum'",
'limit' => '1',
));
$videos = @$videosRecords[0]; // get first record

?>


And then I put variables to list as:

<?php echo $videosRecord['title'] ?>
<?php echo $videosRecord['description'] ?>

But it seems to take me the uploads but no the videosRecord, as you can see in:

http://www.utahreoexperts.com/selling-your-home/videos-about-selling-a-home/video/?Video-1-Selling.-3

Please help with this one.

Cheers, Juan.

Re: [jposwald] 'Where' to find an answer!

By Dave - October 22, 2008

Hi Juan,

A quick question first - what version of CMS Builder are you running?
Dave Edis - Senior Developer
interactivetools.com
Dave,

I'm running 1.22 version.

Re: [jposwald] 'Where' to find an answer!

By Dave - October 23, 2008

Try this:

<?php echo $videos['title'] ?>
<?php echo $videos['description'] ?>

Let me know if that fixes it.
Dave Edis - Senior Developer
interactivetools.com