Viewer pages don't show as soon as I add another viewer code...

5 posts by 3 authors in: Forums > CMS Builder
Last Post: April 17, 2011   (RSS)

By Izadorra - April 15, 2011

I know this has to be something really simple but I suck at programming so I can't figure out which character is giving me a problem.

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


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/nmcleanc/public_html/','','../','../../','../../../');
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
list($featured_storiesRecords, $featured_storiesMetaData) = getRecords(array(
'tableName' => 'featured_stories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$featured_storiesRecord = @$featured_storiesRecords[0]; // get first record

// show error message if no matching record is found
if (!$featured_storiesRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>

works. But when when I try to add another viewer to the page:

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


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/nmcleanc/public_html/','','../','../../','../../../');
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
list($featured_storiesRecords, $featured_storiesMetaData) = getRecords(array(
'tableName' => 'featured_stories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$featured_storiesRecord = @$featured_storiesRecords[0]; // get first record

// show error message if no matching record is found
if (!$featured_storiesRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>

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


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/nmcleanc/public_html/','','../','../../','../../../');
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
list($featured_storiesRecords, $featured_storiesMetaData) = getRecords(array(
'tableName' => 'featured_stories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$featured_storiesRecord = @$featured_storiesRecords[0]; // get first record

// show error message if no matching record is found
if (!$featured_storiesRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>

Does not work. I get a broken link error and the page doesn't show at all.

Re: [gkornbluth] Viewer pages don't show as soon as I add another viewer code...

By Izadorra - April 15, 2011

Thank you! Works just the way I want it to.

Re: [Izadorra] Viewer pages don't show as soon as I add another viewer code...

By abincline - April 16, 2011

I also had trouble identifying which character is causing me the problem. I am not really good at programming but thanks to your post.

Re: [abincline] Viewer pages don't show as soon as I add another viewer code...

By Izadorra - April 17, 2011

I never got above a C in programming but I'm a great "copy & paster". I remember struggling with "hello world".

But my java professor gave me the best advice ever, he said "if it is a code that is needed then someone else has already written it." Go forth and find it. Hence, the beginning of my "copy & paste" career.

I went ahead and invested in the CMS Builders Cookbook that was mentioned by the very nice person that helped me. I had to justify it to my husband by telling him it was like trying to work on a car without the owners manual. I haven't received it yet but I'm hoping it will save me some time.