Undefined Variable

6 posts by 3 authors in: Forums > CMS Builder
Last Post: October 26, 2012   (RSS)

Im getting a lot of "NOTICE: UNDEFINED VARIABLE:" while trying to display records on a detail page of mine...
this is an example...
http://seenstream.com/detail.php?Speakeasy-Ultra-Lounge-3

I thought I have the code right, but apparently I dont. Im thinking i have something wrong here...

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php require_once "cmsAdmin/lib/viewer_functions.php"; ?>
<?php if (!@$GLOBALS['GEOCODER_PLUGIN']) { die("You must activate the Geocoder plugin before you can access this page."); } ?>
<?php

// get records
list($participating_barsRecords, $participating_barsMetaData) = getRecords(array(
'tableName' => 'participating_bars',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$record = @$participating_barsRecords[0]; // get first record

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

?>

Re: [shawnpatoka] Undefined Variable

Hi shawnpatoka ,

The error message points to an issue on line 87 of your page.

Without seeing the actual php code it's harder to figure out exactly what's going on.

Could you attach your page code?

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Undefined Variable

sorry about that...

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php require_once "cmsAdmin/lib/viewer_functions.php"; ?>
<?php if (!@$GLOBALS['GEOCODER_PLUGIN']) { die("You must activate the Geocoder plugin before you can access this page."); } ?>
<?php

// get records
list($participating_barsRecords, $participating_barsMetaData) = getRecords(array(
'tableName' => 'participating_bars',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$record = @$participating_barsRecords[0]; // get first record

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

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo htmlencode($participating_barsRecord['html_title']) ?></title>
<link href="ip_style.css" rel="stylesheet" type="text/css" />
<style type="text/css" media="screen">
.menu { padding: 0; clear: both; margin-top: -7px;}
.menu li { display: inline; -moz-border-radius:3px; -webkit-border-radius: 3px; border-radius:3px; background-color: #d9d9d9; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 11px; color: #575757; padding: 5px 10px 6px 10px; float: left; margin-right: 15px; margin-bottom: 5px;}
.menu li a { color: #575757; font-family:Arial, Helvetica, sans-serif; text-decoration:none;}
.menu li.active a { }
.content { float: left; clear: both; width: 514px; padding: 10px 20px 20px; background:#fff; border:1px solid #d9d9d9; -moz-box-shadow: rgba(0, 0, 0, 0.1) 0 0 2px 0px; -webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 0 2px 0px;box-shadow: rgba(0, 0, 0, 0.1) 0 0 2px 0px; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; }
</style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var latitude = <?php echo floatval(@$participating_barsRecords['latitude']); ?>;
var longitude = <?php echo floatval(@$participating_barsRecords['longitude']); ?>;
var mapCanvasId = 'map_canvas';
if (latitude) {
var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById(mapCanvasId), mapOptions);
var latLng = new google.maps.LatLng(latitude, longitude);
var marker = new google.maps.Marker({map: map, position: latLng });

map.setCenter(latLng);
map.setZoom(14);
}
}
</script>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34997255-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</head>

<body onload="initialize()">
<?php include('includes/navigation.php'); ?>
<div id="content-container">
<div id="stream-container"><iframe width="425" height="319" src="http://www.youtube.com/embed/91Ax52Wmk8k" frameborder="0" allowfullscreen></iframe></div>
<div id="description-container">
<div id="desc-header-container"><h1 class="venue-desc-header"><?php echo htmlencode($participating_barsRecord['title']) ?></h1><p class="venue-desc-body"><?php echo htmlencode($participating_barsRecord['address']) ?><br /><?php echo htmlencode($participating_barsRecord['phone_number']) ?></p></div>

<p class="venue-desc-body"><?php echo htmlencode($participating_barsRecord['description']) ?></p></div>

<div id="horizontal-ad-container"><div id="horizontal-ad"><a href="http://www.llsmiling.com/" target="_blank"><img class="horiz-ad" src="i/lls_ad_728x90.jpg" /></a></div></div>


<div id="column-left">

<ul id="menu" class="menu">
<li class="active"><a href="#pictures">Pictures</a></li>
<li><a href="#specials">Specials</a></li>
</ul>
<div id="pictures" class="content">
<p><?php foreach ($participating_barsRecord['pictures'] as $index => $upload): ?>
<div class="pic-thumb"><a href="<?php echo $upload['urlPath'] ?>" target="_blank"><img src="<?php echo $upload['thumbUrlPath'] ?>" border="0"/></a></div>
<?php endforeach ?></p>
</div>
<div id="specials" class="content">
<p class="text"><?php echo htmlencode($participating_barsRecord['specials_tab']) ?></p>
</div>
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.tabify.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
// <![CDATA[

$(document).ready(function () {
$('#menu').tabify();
$('#menu2').tabify();
});

// ]]>
</script>



<!--<div class="button">pictures</div><div class="button">specials</div><br class="clear" />
<div class="whitebox">
<?php foreach ($participating_barsRecord['pictures'] as $index => $upload): ?>
<div class="pic-thumb"><a href="<?php echo $upload['urlPath'] ?>" target="_blank"><img src="<?php echo $upload['thumbUrlPath'] ?>" border="0"/></a></div>
<?php endforeach ?>
<div style="clear: both;"></div>
</div>
-->
</div><!--column-left-->

<div id="column-right">
<div id="square-map">
<?php if (@$participating_barsRecord['latitude']): ?>
<div id="map_canvas" style="width: 299px; height: 299px; float: left; margin: 0px 15px;"></div>
<?php endif ?>

<?php if (!@$participating_barsRecord['latitude']): ?>
<div style="width: 299px; height: 299px; float: left; margin: 0px 15px; border: 1px solid #000;">
<div style="text-align: center; padding-top: 135px">
No map available!
</div>
</div>
<?php endif ?>
</div>
<div id="tellafriend"><h3>Tell a Friend</h3>
<input name="" type="text" class="tell" placeholder="friendsname@email.com" /><input class="btn" name="Submit" type="button" label=" " value=" " /></div>
</div><!--column-right-->

<br class="clear" />
</div><!-- content container-->

<?php include('includes/footer.php'); ?>
</body>
</html>

Re: [shawnpatoka] Undefined Variable

Hi shawnpatoka,

Running out the door, but the only thing I can see off the top, (others with keener eyes may differ) is that in the participating_bars list records call you might try:

'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',


Best,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [greg] Undefined Variable

That's why the IT folks get the big bucks.

They really understand what they're doing.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php