Strange issue

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 9, 2009   (RSS)

By Ginslinger - April 8, 2009 - edited: April 8, 2009

Working on creating a news page and have created a news.php page for the list page and news_detail for the detail page.

List page will show all entries and link to detail page works fine but only for the first entry. Trying to access detail page for anything other than the first entry only brings up record not found. I have spent way to much time trying to figure out what is going on. Any ideas? I could understand it if nothing showed but why only one article and not others?

Here is a link to the page in question. Click on Shrove Tuesday link and it will work. Others come up record not found
http://www.stdavidsonline.org/news.php

Re: [jdancisin] Strange issue

By Ginslinger - April 9, 2009

From the list page. As you will notice I have another viewer that shows in the same page (Deadline) I have search shut down as I thought that may be a conflict but no luck.

(From List page)

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

<?php

require_once "/home/stdavid/public_html/cms/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
));

?>


<?php

require_once "/home/stdavid/public_html/cms/lib/viewer_functions.php";

list($deadlineRecords, $deadlineMetaData) = getRecords(array(
'tableName' => 'deadline',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => 'false',
));
$deadlineRecord = @$deadlineRecords[0]; // get first record

// show error message if no matching record is found
if (!$deadlineRecord) {
print "Record not found!";
exit;
}

?>

<?php foreach ($newsRecords as $record): ?>
<strong><u><?php echo $record['title'] ?></u></strong><br/>
<?php echo $record['content'] ?>
<a href="<?php echo $record['_link'] ?>">Link</a><br/>

<hr/>
<?php endforeach; ?>

<?php if (!$newsRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

(From Detail Page)

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

<?php
require_once "/home/stdavid/public_html/cms/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => 'false',

));
$newsRecord = @$newsRecords[0]; // get first record

// show error message if no matching record is found
if (!$newsRecord) {
print "Record not found!";
exit;
}

?>



<?php
require_once "/home/stdavid/public_html/cms/lib/viewer_functions.php";

list($deadlineRecords, $deadlineMetaData) = getRecords(array(
'tableName' => 'deadline',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$deadlineRecord = @$deadlineRecords[0]; // get first record

// show error message if no matching record is found
if (!$deadlineRecord) {
print "Record not found!";
exit;
}

?>

Record Number: <?php echo $newsRecord['num'] ?><br/>
Title: <?php echo $newsRecord['title'] ?><br/>
Content: <?php echo $newsRecord['content'] ?><br/>
_link : <a href="<?php echo $newsRecord['_link'] ?>"><?php echo $newsRecord['_link'] ?></a><br/>

<hr/>
<?php if (!$newsRecord): ?>
No record found!<br/><br/>
<?php endif ?>

<a href="<?php echo $newsMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a>



<div align="center"><u><strong> <?php echo $deadlineRecord['title'] ?></strong></u></div><br />
<?php echo $deadlineRecord['content'] ?>

Re: [Ginslinger] Strange issue

By zip222 - April 9, 2009

I think its likely that the error is coming from the second viewer (deadline), but you don't need to remove it, you just need to remove the bold line below...

<?php
require_once "/home/stdavid/public_html/cms/lib/viewer_functions.php";

list($deadlineRecords, $deadlineMetaData) = getRecords(array(
'tableName' => 'deadline',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$deadlineRecord = @$deadlineRecords[0]; // get first record

// show error message if no matching record is found
if (!$deadlineRecord) {
print "Record not found!";
exit;
}

?>

Re: [jdancisin] Strange issue

By Ginslinger - April 9, 2009

That did the trick. Appreciate the help.

Thanks

Tim