Detail Display
5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 5, 2010 (RSS)
By JLynne77 - February 3, 2010 - edited: February 3, 2010
From the working section, I have (abbreviated code):
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/home/carco1/cmsAdmin/lib/viewer_functions.php"; list($hr_solutionsRecords, $hr_solutionsMetaData) = getRecords(array(
'tableName' => 'hr_solutions',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$hr_solutionsRecord = @$hr_solutionsRecords[0]; // get first record
// show error message if no matching record is found
if (!$hr_solutionsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
<title><?php echo $hr_solutionsRecord['title'] ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $hr_solutionsRecord['meta_description'] ?>" />
<meta name="keywords" content="<?php echo $hr_solutionsRecord['meta_keywords'] ?>" />
<?php echo $hr_solutionsRecord['description'] ?>
For the section that shows some detail pages, but not all, I have (abbreviated code):
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/home/carco1/cmsAdmin/lib/viewer_functions.php"; list($about_usRecords, $about_usMetaData) = getRecords(array(
'tableName' => 'about_us',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$about_usRecord = @$about_usRecords[0]; // get first record
// show error message if no matching record is found
if (!$about_usRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
<title><?php echo $about_usRecord['title'] ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $about_usRecord['meta_description'] ?>" />
<meta name="keywords" content="<?php echo $about_usRecord['meta_keywords'] ?>" />
<?php echo $about_usRecord['description'] ?>
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/home/carco1/cmsAdmin/lib/viewer_functions.php"; list($investigative_solutionsRecords, $investigative_solutionsMetaData) = getRecords(array(
'tableName' => 'investigative_solutions',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$investigative_solutionsRecord = @$investigative_solutionsRecords[0]; // get first record
// show error message if no matching record is found
if (!$investigative_solutionsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
<title><?php echo $investigative_solutionsRecord['title'] ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $investigative_solutionsRecord['meta_description'] ?>" />
<meta name="keywords" content="<?php echo $investigative_solutionsRecord['meta_keywords'] ?>" />
<?php echo $investigative_solutionsRecord['description'] ?>
These pages all worked fine before adding those areas noted in the code to integrate CMS. As static content, they display normal. They are all pulling the record from the URL using: product_id_sku=(product number here) after a 'filename.php?' in the URL.
As far as I can tell, they all have the same settings in the Section Editor.
Is there something I'm missing here?
~Jessica Sullivan, Crystal Realm Designs.
Re: [Duches77] Detail Display
By Chris - February 3, 2010
There's nothing I can see in your code which might be causing this problem. I'm wondering if the problem could be caused by the whereRecordNumberInUrl() function and the URLs you're using. Do you have some example URLs of working and 404 pages?
Chris
Re: [chris] Detail Display
By JLynne77 - February 4, 2010
http://www.carcogroup.com/resource-center-cms.php?product_id_sku=RC01
Working:
http://www.carcogroup.com/carco-group-cms.php?product_id_sku=AU02
Not working:
http://www.carcogroup.com/carco-group-cms.php?product_id_sku=AU04
Not working:
http://www.carcogroup.com/investigative-solutions-cms.php?product_id_sku=IS03
Thanks for your help.
~Jessica Sullivan, Crystal Realm Designs.
Re: [Duches77] Detail Display
By Chris - February 5, 2010
Ahh, I see what's going on. You'll want to remove these lines from your viewers:
'where' => whereRecordNumberInUrl(1),
The whereRecordNumberInUrl function is meant to work with the default detail viewer urls (e.g. "articleDetails.php?my-article-title-3".) It looks for a number at the end of the URL and uses that to look up the record number (i.e. num field.)
You're using another field to reference records (product_id_sku), which is perfectly fine, but you'll need to get rid of the whereRecordNumberInUrl filter.
I hope this helps! Please let me know if you have any questions.
P.S. The reason your first two links were working was coincidental: RC01 has num=1, and AU02 has num=2!
Chris
Re: [chris] Detail Display
By JLynne77 - February 5, 2010
~Jessica Sullivan, Crystal Realm Designs.