Showing specific "list" records on detail pages
12 posts by 2 authors in: Forums > CMS Builder
Last Post: April 18, 2011 (RSS)
By (Deleted User) - April 15, 2011
I think I got it. And thank you.
I put this code at the top:
////////////////////////////////////////////////////////////////////////////////////////////////
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/webadmin/www/atiintheusa/html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load records
list($bulbsRecords, $bulbsMetaData) = getRecords(array(
'tableName' => 'bulbs',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$bulbsRecord = @$bulbsRecords[0]; // get first record
// load records
list($bulb_specsRecords, $bulb_specsMetaData) = getRecords(array(
'tableName' => 'bulb_specs',
));
// load records
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
));
// show error message if no matching record is found
if (!$bulbsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
<?php
$videosRecordNumbers = join(",", explode("\t", trim($bulbsRecord['videos'], "\t")));
if(!$videosRecordNumbers) { $videosRecordNumbers = 0;}
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
'allowSearch' => false,
'where' => "num IN ($videosRecordNumbers)",
));
?>
////////////////////////////////////////////////////////////////////////////////////////////////
And this code pulled the records:
////////////////////////////////////////////////////////////////////////////////////////////////
<?php $videosCount = 0;?>
<?php foreach ($videosRecords as $videos): ?>
<?php $videosCount ++; ?>
<?php if (($videosCount % 3) == 0): ?>
<div class="videospageR">
<?php echo $videos['video_code'] ?>
<div style="text-align:center;"><?php echo $videos['title'] ?></div>
</div>
<?php else: ?>
<div class="videospageL">
<?php echo $videos['video_code'] ?>
<div style="text-align:center;"><?php echo $videos['title'] ?></div>
</div>
<?php endif ?>
<?php endforeach ?>
////////////////////////////////////////////////////////////////////////////////////////////////
I put this code at the top:
////////////////////////////////////////////////////////////////////////////////////////////////
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/webadmin/www/atiintheusa/html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load records
list($bulbsRecords, $bulbsMetaData) = getRecords(array(
'tableName' => 'bulbs',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$bulbsRecord = @$bulbsRecords[0]; // get first record
// load records
list($bulb_specsRecords, $bulb_specsMetaData) = getRecords(array(
'tableName' => 'bulb_specs',
));
// load records
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
));
// show error message if no matching record is found
if (!$bulbsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
<?php
$videosRecordNumbers = join(",", explode("\t", trim($bulbsRecord['videos'], "\t")));
if(!$videosRecordNumbers) { $videosRecordNumbers = 0;}
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
'allowSearch' => false,
'where' => "num IN ($videosRecordNumbers)",
));
?>
////////////////////////////////////////////////////////////////////////////////////////////////
And this code pulled the records:
////////////////////////////////////////////////////////////////////////////////////////////////
<?php $videosCount = 0;?>
<?php foreach ($videosRecords as $videos): ?>
<?php $videosCount ++; ?>
<?php if (($videosCount % 3) == 0): ?>
<div class="videospageR">
<?php echo $videos['video_code'] ?>
<div style="text-align:center;"><?php echo $videos['title'] ?></div>
</div>
<?php else: ?>
<div class="videospageL">
<?php echo $videos['video_code'] ?>
<div style="text-align:center;"><?php echo $videos['title'] ?></div>
</div>
<?php endif ?>
<?php endforeach ?>
////////////////////////////////////////////////////////////////////////////////////////////////
Re: [kimamel] Showing specific "list" records on detail pages
By Jason - April 18, 2011
Hi,
Glad that's working for you now. Let us know if you run into any other problems
Glad that's working for you now. Let us know if you run into any other problems
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/