4 posts by 2 authors in: Forums > CMS BuilderLast Post: July 28, 2017 (RSS)
By esupport - July 24, 2017
Hi ,
I posted our site link on Facebook. Got error below :
Notice: Undefined variable: about_usRecord in /home2/unicomp/public_html/newsDetail.php on line 49
Screenshot :
http://nimb.ws/zcyPhl
Here is our code:
<?php header('Content-type: text/html; charset=utf-8'); ?><?php /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */ // load viewer library $libraryPath = 'cmsAdmin/lib/viewer_functions.php'; $dirsToCheck = array('/home2/ehost7/public_html/unicomp.com.tw/','','../','../../','../../../'); 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 'news' list($newsRecords, $newsMetaData) = getRecords(array( 'tableName' => 'news', 'where' => whereRecordNumberInUrl(0), 'loadUploads' => true, 'allowSearch' => false, 'limit' => '1', )); $newsRecord = @$newsRecords[0]; // get first record if (!$newsRecord) { dieWith404("Record not found!"); } // show error message if no record found ?>
<?php header('Content-type: text/html; charset=utf-8'); ?><?php /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */ // load viewer library $libraryPath = 'cmsAdmin/lib/viewer_functions.php'; $dirsToCheck = array('/home2/ehost7/public_html/unicomp.com.tw/','','../','../../','../../../'); 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 'news' list($newsRecords, $newsMetaData) = getRecords(array( 'tableName' => 'news', 'where' => whereRecordNumberInUrl(0), 'loadUploads' => true, 'allowSearch' => false, 'limit' => '1', )); $newsRecord = @$newsRecords[0]; // get first record if (!$newsRecord) { dieWith404("Record not found!"); } // show error message if no record found
?>
It only on cmsBuilder site.
Hope you can help,
Thanks!
By Dave - July 25, 2017
Hi jh,
Can you try going to the URL directly, viewing-source in your browser, and searching for "undefined"? Make sure there isn't a hidden error in the page first.
Let me know what you find!
By esupport - July 25, 2017
Hi Dave
YES! Here:
view-source:http://www.unicomp.com.tw/newsDetail.php?1500969170-179
There are two "Undefined variable" on this page :
<meta name="Description" content="Notice: Undefined variable: about_usRecord in /home2/unicomp/public_html/newsDetail.php on line 49" /><meta name="Keywords" content="Notice: Undefined variable: about_usRecord in /home2/unicomp/public_html/newsDetail.php on line 50" />
The page here :
http://www.unicomp.com.tw/newsDetail.php?1500969170-179
What can I do for fixing this page??
Thank you!
By Dave - July 28, 2017
So you need to figure out why $about_usRecord isn't defined. There is a problem with how the page is setup. If you can attach newsDetail.php to this post we can take a look.