Details Page no record found
8 posts by 3 authors in: Forums > CMS Builder
Last Post: November 24, 2009 (RSS)
By MRI - November 18, 2009
Only one list item is linking correctly, the other give me "No Record Found" message.
Im not sure if it is because on the details page, I have another multiple records list displaying.
HEres the code at the top of my detaisl page:
<?php
require_once "/XXXXXXX";
list($ad_managerRecords, $ad_managerMetaData) = getRecords(array(
'tableName' => 'ad_manager',
'limit' => '2',
'orderBy' => 'RAND()',
'where' => " page_display LIKE '%\tAll\t%' ",
));
?>
<?php
require_once "/XXXXXXX";
list($employment_pageRecords, $employment_pageMetaData) = getRecords(array(
'tableName' => 'employment_page',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$employment_pageRecord = @$employment_pageRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_pageRecord) {
print "Record not found!";
exit;
}
?>
<?php
require_once "/XXXXXXX";
list($employment_listingsRecords, $employment_listingsMetaData) = getRecords(array(
'tableName' => 'employment_listings',
'limit' => '1',
));
$employment_listingsRecord = @$employment_listingsRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_listingsRecord) {
print "Record not found!";
exit;
}
?>
The employment_listings is the record that is not displaying..
you can preview at: http://runningaces.mriinteract.net/employment/index.php
The Housekeeping works but not the others.
Also I would like to know if there is a way for the Job Category title not display if there are no records under that category.
I have set up just one multiple record manager in the CMS and when you enter a job listing, you select a category the listing goes under.
For if you look at the link above... I would like "Card Room, Finance etc" not display since there are no records under that category
THANKS IN ADVANCE!
Re: [MRI] Details Page no record found
By gkornbluth - November 18, 2009 - edited: November 18, 2009
If I understand you correctly, I'd try removing the:
where' => whereRecordNumberInUrl(1),
in the employment listings and see if that helps. Sometimes the 'limit' => '1',
can give strange results as well. You might also, add:
allowSearch => false,
so later when you add search engines it won't "filter" those records, since I'm assuming you’ll want to show them all the time.
The issue of not showing particular text can be done using an "if" statement around the HTML entry with a ! (not) before the $ as in the "records not found!", below.
You don't have to repeat the entire block of "require once" code on your page either.
You can use:
<?php
require_once "/XXXXXXX";
list($ad_managerRecords, $ad_managerMetaData) = getRecords(array(
'tableName' => 'ad_manager',
'limit' => '2',
'orderBy' => 'RAND()',
'where' => " page_display LIKE '%\tAll\t%' ",
));
list($employment_pageRecords, $employment_pageMetaData) = getRecords(array(
'tableName' => 'employment_page',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$employment_pageRecord = @$employment_pageRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_pageRecord) {
print "Record not found!";
exit;
}
list($employment_listingsRecords, $employment_listingsMetaData) = getRecords(array(
'tableName' => 'employment_listings',
'limit' => '1',
));
$employment_listingsRecord = @$employment_listingsRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_listingsRecord) {
print "Record not found!";
exit;
}
?>
If you know that you don't need them, you can remove the:
// show error message if no matching record is found
if (!$employment_pageRecord) {
print "Record not found!";
exit;
}
or change "Record not found!" to anything that you prefer.Hope this sets you in the right direction.
Best,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Details Page no record found
By MRI - November 19, 2009
let focus on the first issue.. then we figure out the second question i had.
ok lets try again..
http://runningaces.mriinteract.net/employment/index.php
This page lists all the job listings.. (page displays fine)
heres the header php code:
<?php
require_once "xxx";
list($ad_managerRecords, $ad_managerMetaData) = getRecords(array(
'tableName' => 'ad_manager',
'limit' => '2',
'orderBy' => 'RAND()',
'where' => " page_display LIKE '%\tAll\t%' ",
));
?>
<?php
require_once "xxx";
list($employment_pageRecords, $employment_pageMetaData) = getRecords(array(
'tableName' => 'employment_page',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$employment_pageRecord = @$employment_pageRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_pageRecord) {
print "Record not found!";
exit;
}
?>
<?php
require_once "xxx";
list($employment_listingsRecords, $employment_listingsMetaData) = getRecords(array(
'tableName' => 'employment_listings',
));
?>
Then when you click on a job listing... it should take you to the details page:
http://runningaces.mriinteract.net/employment/joblistings.php
this works fine: http://runningaces.mriinteract.net/employment/joblistings.php?HOUSEKEEPER-1
but any other job listing does not... i get the Record not found messages..
HEres the code on the details page:
<?php
require_once "xxx";
list($ad_managerRecords, $ad_managerMetaData) = getRecords(array(
'tableName' => 'ad_manager',
'limit' => '2',
'orderBy' => 'RAND()',
'where' => " page_display LIKE '%\tAll\t%' ",
));
?>
<?php
require_once "xxx";
list($employment_pageRecords, $employment_pageMetaData) = getRecords(array(
'tableName' => 'employment_page',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$employment_pageRecord = @$employment_pageRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_pageRecord) {
print "Record not found!";
exit;
}
?>
<?php
require_once "xxx";
list($employment_listingsRecords, $employment_listingsMetaData) = getRecords(array(
'tableName' => 'employment_listings',
'limit' => '1',
));
$employment_listingsRecord = @$employment_listingsRecords[0]; // get first record
// show error message if no matching record is found
if (!$employment_listingsRecord) {
print "Record not found!";
exit;
}
?>
can i send you files to review?
I think the conflict has to do with having multiple list records/single record on the same page.
Re: [MRI] Details Page no record found
I know that this is probably not what you want to hear, but...
Most of the time, the easiest approach to troubleshooting is to start simple and build on that. You have all of your section editors populated with data so it should be a pretty easy task.
Try mocking mock up a simple page that displays data from one section editor, without any formatting and with only a few fields from the admin's generated code area.
Once that's working, add the next section to the page and mock up a few fields from that.
See where you get into trouble and then make the appropriate changes on your finished pages.
I'd simplify the code at the top of your page as a start so that you can get a clearer picture of what's going on.
Hope that this approach gets you closer.
You can always post the code of your pages here (no sensitive or access information) but unless a problem pops out easily, it's sometimes difficult to digest the approach that you're using and ferret out the issues.
Best,
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Details Page no record found
By MRI - November 19, 2009
Now, just need help with the removing of the header text if there are no records in that section.
Heres how its set up.. http://runningaces.mriinteract.net/employment/
in the CMS I have a Employment listings where you can add new job listings... then you select which category it show show up in.
If there are no job listings in a certain category, I would like that category header to not display.
Heres how the listings are set up:
<h3><strong>CARD ROOM</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Card Room')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>FACILITIES</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Facilities')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>FINANCE</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Finance')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>FOOD & BEVERAGE</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Food and Beverage')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>HUMAN RESOURCES</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Human Resources')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>INFORMATION TECHNOLOGY</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Information Technology')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>MARKETING</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Marketing')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>MUTUELS</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Mutuels')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>RACING</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Racing')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
<h3><strong>SECURITY/SURVEILLANCE</strong></h3>
<ul>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Security')): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
</ul>
Re: [MRI] Details Page no record found
You also seem to understand "if" statements fairly well.
I've got to run out now, but I'm sure you'll get it fixed.
Best,
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [MRI] Details Page no record found
By Chris - November 24, 2009 - edited: November 24, 2009
Did you get your conditional header text working?
If not, you could try something like this:
<?php $found = 0; ?>
<?php foreach ($employment_listingsRecords as $record): ?>
<?php if (strpos($record['category'], 'Card Room')): ?>
<?php if (!$found): ?>
<h3><strong>CARD ROOM</strong></h3>
<ul>
<?php $found = 1; ?>
<?php endif ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['job_title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>
<?php if ($found): ?>
</ul>
<?php endif ?>
Please let us know if you have any questions.
Chris
Re: [chris] Details Page no record found
By MRI - November 24, 2009