Hi Mel,
At the moment you're accessing the MySQL database directly to retrieve the record you want to display. But CMS Builder comes with some useful functionality that makes retrieving records and all of there linked data (images, drop down selections, details of the user who created the record, etc) much easier.
In your CMS admin area will be a section called Code Generator, and this will generate the code that allows you to retrieve the records from a particular section. You can read more about it here:
http://www.interactivetools.com/docs/cmsbuilder/code_generator.html
This video also goes over the basic concept of adding records to the front end of your website:
https://www.interactivetools.com/tour/video.php
So for the example you've got below, you'd need to do something like this to display the content:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('C:/wamp/www/','','../','../../','../../../');
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 from 'gallery'
list($biosRecords, $biosMetaData) = getRecords(array(
'tableName' => 'bios',
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1'
));
$bios = $biosRecords[0];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Record display test</title>
</head>
<body>
<div><?php echo $bios['name']; ?>
<?php echo $bios['age']; ?>
<?php if(@$bios['new_imageNS'][0]): ?>
<?php foreach($bios['new_imageNS'] as $image): ?>
<a href="<?php echo $bios['_link'] ?>" target="_self">
<img src="<?php ecoh $image['urlPath']; ?>" width="<?php echo $image['width'] ?>" height="<?php echo $image['height'] ?>" alt="<?php echo $bios['name'] ?>">
</a>
<?php endforeach; ?>
<?php endif; ?>
</div>
</body>
</html>
This is just example code, so you might have to make a few changes to get it working (the most likely being the name of the image field).
So I've combined the code that is generated by the code generator and your example code to display the content on the page.
The foreach loop will loop through each image that is uploaded, and display it on the page.
Let me know if you have any other questions.
Thanks!
Greg
Greg Thomas
PHP Programmer - interactivetools.com