All list links point to same detail listing?

8 posts by 2 authors in: Forums > CMS Builder
Last Post: July 10, 2012   (RSS)

Re: [Dave R] All list links point to same detail listing?

By Jason - July 8, 2012

Hi Dave,

CMS Builder is set up so that you use a single detail page for a given section. That way the display and layout is always the same, just the content is different. Is there a reason why you need each record to go to a different detail page?

If so, one thing you could do is add a "detail_page" field to your section. For each record, enter a different detail page file name. In your list page code, you can use the value of "detail_page" in you link instead of the default "_link" pseudo field.

Hope this helps get you started.
---------------------------------------------------
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] All list links point to same detail listing?

By Dave R - July 8, 2012

Hi Jason,

What I'm wanting to achieve is to build a directory, thousands of listings. At the moment, I have created 6 test / dummy listings. When I click on the links, they all point to the same listing. If that doesn't explain it better... think of Listings Manager... listings list, with links to details... but whenever I follow the links from listings list... they all point to the same content.

I can always email you the admin login if that helps.

Thanks
Dave

Re: [Dave R] All list links point to same detail listing?

By Dave R - July 9, 2012 - edited: July 9, 2012

Just an update: I note other customers are requesting urgent attention with issues. Conversely, I am in no rush and happy to wait... tis a project that has been in the "We'll get around to that one day" box for a long long time... please do prioritise others. [;)]

Cheers
Dave

Re: [Dave R] All list links point to same detail listing?

By Jason - July 9, 2012

Hi Dave,

Thank you for your patience, it's really appreciated!

I think I see what you are getting at now. If you could post a link to your list page, and attach the code for your detail page, I think we can figure out why your detail page is always displaying the same content.

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] All list links point to same detail listing?

By Dave R - July 10, 2012

Hi Jason,

I've emailed you the URL's, it's very early stages and we'd like to keep the cat in the bag for the time being and have an official launch when ready etc.

There are three images in the code, but the intention is to have quite a few more, possibly 10 or more.

Cheers
Dave

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/usr/local/home/httpd/vhtdocs/www.thedomain.com/','','../','../../','../../../');
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 record from 'lawyers'
list($lawyersRecords, $lawyersMetaData) = getRecords(array(
'tableName' => 'lawyers',
'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => true,
'limit' => '1',
));
$lawyersRecord = @$lawyersRecords[0]; // get first record
if (!$lawyersRecord) { dieWith404("Record not found!"); } // show error message if no record found

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
<link rel="stylesheet" href="../scripts/lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src=" ../scripts/slimbox/js/mootools.js "></script>
<script type="text/javascript" src=" ../scripts/slimbox/js/slimbox.js "></script>
<link rel="stylesheet" href=" ../scripts/slimbox/css/slimbox.css " type="text/css" media="screen" />
</head>
<body>
<!-- STEP2: Display Record (Paste this where you want your record to appear) -->
<h1>Lawyers - Detail Page Viewer</h1>
Record Number: <?php echo htmlencode($lawyersRecord['num']) ?><br/>
Company: <?php echo htmlencode($lawyersRecord['company']) ?><br/>
Phone Number: <?php echo htmlencode($lawyersRecord['phone_number']) ?><br/>
Address Line 1: <?php echo htmlencode($lawyersRecord['address_line_1']) ?><br/>
Address Line 2: <?php echo htmlencode($lawyersRecord['address_line_2']) ?><br/>
County: <?php echo htmlencode($lawyersRecord['county']) ?><br/>
Country (value): <?php echo $lawyersRecord['country'] ?><br/>
<!--Country (label): <?php echo $lawyersRecord['country:label'] ?><br/>-->
Postcode: <?php echo htmlencode($lawyersRecord['postcode']) ?><br/>
Content: <?php echo $lawyersRecord['content']; ?><br/>
_link : <a href="<?php echo $lawyersRecord['_link'] ?>"><?php echo $lawyersRecord['_link'] ?></a><br/>

<!-- STEP 2a: Display Uploads for field 'image_1' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
Image 1:
<blockquote>
<?php foreach ($lawyersRecord['image_1'] as $index => $upload): ?>
Upload Url: <?php echo $upload['urlPath'] ?><br/>



Thumb Url: <?php echo $upload['thumbUrlPath'] ?><br/><br/>
Download Link: <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/><br/>

Image Tags:<br/>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox-atomium" title="<?php echo htmlencode($upload['info2']) ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" /></a><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Caption) : <?php echo htmlencode($upload['info2']) ?><br/><br/>

Extension: <?php echo $upload['extension'] ?><br/>
isImage: <?php if ($upload['isImage']): ?>Yes<?php else: ?>No<?php endif ?><br/>
hasThumbnail: <?php if ($upload['hasThumbnail']): ?>Yes<?php else: ?>No<?php endif ?><br/>
<hr/>


<?php endforeach ?>
</blockquote>
<!-- STEP2a: /Display Uploads -->


<!-- STEP 2a: Display Uploads for field 'image_2' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
Image 2:
<blockquote>
<?php foreach ($lawyersRecord['image_2'] as $index => $upload): ?>
Upload Url: <?php echo $upload['urlPath'] ?><br/>



Thumb Url: <?php echo $upload['thumbUrlPath'] ?><br/><br/>
Download Link: <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/><br/>

Image Tags:<br/>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox-atomium" title="<?php echo htmlencode($upload['info2']) ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" /></a><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Caption) : <?php echo htmlencode($upload['info2']) ?><br/><br/>

Extension: <?php echo $upload['extension'] ?><br/>
isImage: <?php if ($upload['isImage']): ?>Yes<?php else: ?>No<?php endif ?><br/>
hasThumbnail: <?php if ($upload['hasThumbnail']): ?>Yes<?php else: ?>No<?php endif ?><br/>
<hr/>


<?php endforeach ?>
</blockquote>
<!-- STEP2a: /Display Uploads -->


<!-- STEP 2a: Display Uploads for field 'image_3' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
Image 3:
<blockquote>
<?php foreach ($lawyersRecord['image_3'] as $index => $upload): ?>
Upload Url: <?php echo $upload['urlPath'] ?><br/>



Thumb Url: <?php echo $upload['thumbUrlPath'] ?><br/><br/>
Download Link: <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/><br/>

Image Tags:<br/>
<a href="<?php echo $upload['urlPath'] ?>" rel="lightbox-atomium" title="<?php echo htmlencode($upload['info2']) ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" /></a><br/>

info1 (Title) : <?php echo htmlencode($upload['info1']) ?><br/>
info2 (Caption) : <?php echo htmlencode($upload['info2']) ?><br/><br/>

Extension: <?php echo $upload['extension'] ?><br/>
isImage: <?php if ($upload['isImage']): ?>Yes<?php else: ?>No<?php endif ?><br/>
hasThumbnail: <?php if ($upload['hasThumbnail']): ?>Yes<?php else: ?>No<?php endif ?><br/>
<hr/>


<?php endforeach ?>
</blockquote>
<!-- STEP2a: /Display Uploads -->

<!-- /STEP2: Display Record -->
<hr/>

<a href="<?php echo $lawyersMetaData['_listPage'] ?>">&lt;&lt; Back to list page</a>
<a href="mailto:?subject=<?php echo urlencode(thisPageUrl()) ?>">Email this Page</a>

</body>
</html>

Re: [Dave R] All list links point to same detail listing?

By Jason - July 10, 2012

Hi Dave,

Thank you for the email. I can see what's happening now.

The issue here is that the getRecords() call in your detail page doesn't have any thing in it's WHERE clause. This results in it always retrieving the first record in the list.

Try this instead:

// load record from 'lawyers'
list($lawyersRecords, $lawyersMetaData) = getRecords(array(
'tableName' => 'lawyers',
'where' => whereRecordNumberInUrl(0),
'loadUploads' => true,
'allowSearch' => true,
'limit' => '1',
));


This should take care of the issue for you.

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] All list links point to same detail listing?

By Dave R - July 10, 2012

[:)] Thanks!