'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

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

By Dave - July 7, 2008

Perch, here's the code in modern format. Note that I don't have all your sections setup locally so this is untested.

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

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


Let me know how it goes! :)
Dave Edis - Senior Developer
interactivetools.com

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

By jposwald - October 22, 2008

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

By jposwald - October 22, 2008

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