Google maps

9 posts by 3 authors in: Forums > CMS Builder
Last Post: November 30, 2009   (RSS)

Code in my listing detail.php:

<a href="http://maps.google.com/maps?q=<?php echo urlencode($listings['address']) ?>,<?php echo urlencode($listings['city']) ?>,<?php echo urlencode($listings['state']) ?>" target="_blank">Click Here to view map of area</a>


Error I recieve:

[/#cc0000][url "http://maps.google.com/maps?q=Notice:+Undefined+variable:+listings+record+in+D:%5CHosting%5C5228253%5Chtml%5Clistingdetail.php+on+line+104,Notice:+Undefined+variable:+listingsrecord+in+D:%5CHosting%5C5228253%5Chtml%5Clistingdetail.php+on+line+104,Notice:+Undefined+variable:+listingsrecord+in+D:%5CHosting%5C5228253%5Chtml%5Clistingdetail.php+on+line+104&ie=UTF8&hl=en&oi=localspell&ct=clnk&cd=1"]Notice: Undefined variable: listings record in D:\Hosting\5228253\html\listingdetail.php on line 104,Notice: Undefined variable: listingsrecord in D:\Hosting\5228253\html\listingdetail.php on line 104,Notice: Undefined variable: listingsrecord in D:\Hosting\5228253\html\listingdetail.php on line 104[/#0000cc][/url]

When I do a search the addres, city and state show up fine in the lisiting.php and listingsdetail.php.

Re: [k4tlove] Google maps

By Luke - November 26, 2009

Hi k4tlove ,

It's a little hard to tell what's causing the problem without looking at the source code.

Would it be possible for you to post the full source code of your listingsdetail.php page?

Cheers,
Luke
Luke Holzken
Product Development

Re: [Luke] Google maps

By k4tlove - November 26, 2009 - edited: November 26, 2009



I removed the following line and Google maps works, but when I search for the properties I always get the same location.

'where' => whereRecordNumberInUrl(1),


So I put the above code back in and now both Google Maps and the search for properties works. Not sure how I made that happen.

Thanks,

Re: [Luke] Google maps

Here is the full source code:

Other things that are wrong: (1.) on my check boxes it shows "0" instead of "NO" and "1" instead of "Yes". (2.) I want my image thumbnails to show up in 2 rows horizontal with the larger image above the thumnails.

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

require_once "D:/Hosting/5228253/html/cmsadmin/lib/viewer_functions.php";

list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$listingsRecord = @$listingsRecords[0]; // get first record

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

?>
<?php include "include_header.php"; ?>


<div class="subheader">View Listings : <?php echo $listingsRecord['address'] ?>, <?php echo $listingsRecord['city'] ?>, <?php echo $listingsRecord['state'] ?> <?php echo $listingsRecord['zipcode'] ?></div><br/>

<table border="0" cellspacing="0" cellpadding="2" width="590">
<tr>
<td rowspan="20" valign="top" align="center" width="165">

LISTING PHOTOS<br/>
<b>Click photo to enlarge</b><br/><br/>

<?php foreach ($listingsRecord['uploads'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="1" alt="Photo" /></a><br/>
<?php echo $upload['info1'] ?><br/>
<?php endif ?>
<?php endforeach ?>

<?php if (!$listingsRecord['uploads']): ?>
<table border="0" cellspacing="0" cellpadding="0" width="150" height="100">
<tr><td bgcolor="#EEEEEE" align="center"><b>Photo<br/>Not<br/>Available</b></td></tr>
</table>
<?php endif; ?>


</td>
<td valign="top"><br/>
<br/></td></tr></table>

<p><img src="images/tophousebanner2.jpg" width="754" height="40" /></p>
<table border="0" cellspacing="2" cellpadding="0" width="100%">
<tr>
<td width="25%">Type:&nbsp;</td>
<td width="25%"><?php echo $listingsRecord['property_type'] ?>&nbsp;</td>
<td width="30%">Monthly Rent:</td>
<td width="20%"><b>$<?php echo $listingsRecord['rent'] ?></b></td>
</tr>
<tr>
<td>Bedrooms:</td>
<td><?php echo $listingsRecord['bedrooms'] ?></td>
<td>Deposit:</td>
<td>$<?php echo $listingsRecord['deposit'] ?></td>
</tr>
<tr>
<td>Bathrooms:&nbsp;</td>
<td><?php echo $listingsRecord['bedrooms'] ?></td>
<td>Available:</td>
<td><?php echo $listingsRecord['available'] ?></td>
</tr>
<tr>
<td>Stories:&nbsp;</td>
<td><?php echo $listingsRecord['stories'] ?></td>
</tr>
<tr>
<td>Square Feet:&nbsp;</td>
<td><?php echo $listingsRecord['area'] ?><br/></td>
</tr>
<tr>
<td>Garage:</td>
<td><?php echo $listingsRecord['garage'] ?></td>
</tr>
<tr>
<td>Carport:</td>
<td><?php echo $listingsRecord['carport'] ?></td>
</tr>
<tr>
<td>Fireplace:&nbsp;</td>
<td><?php echo $listingsRecord['fireplace'] ?></td>
</tr>
<tr>
<td valign="top">Appliances:&nbsp;</td>
<td colspan="3"><?php echo $listingsRecord['appliances'] ?>
<p>&nbsp;</p></td>
</tr>
</table>
<table width="419" border="0" cellpadding="0" cellspacing="2">
<tr>
<td valign="top">Description: </td>
<td><?php echo $listingsRecord['description'] ?>
<p>&nbsp;</p></td>
</tr>
<tr>
<td>View Map:&nbsp;</td>
<td><a href="http://maps.google.com/maps?f=q&h1=en&geocode=&q=<?php echo urlencode($listingsRecord['address']) ?>,<?php echo urlencode($listingsRecord['city']) ?>,<?php echo urlencode($listingsRecord['state']) ?>" target="_blank">Click Here to view map of area</a>
</td>
</tr>
</table>
<br />
<?php include "include_footer.php"; ?>

Re: [k4tlove] Google maps

By Chris - November 27, 2009

Hi k4tlove,

on my check boxes it shows "0" instead of "NO" and "1" instead of "Yes".


If you're using CMS Builder version 1.34 or later, you can use the ':text' psuedo-field to display Yes/No instead of 1/0. For example:

<?php echo $listingsRecord['fireplace:text'] ?>

If you're using an older version and can't upgrade, please let me know and I'll find you another solution.

I want my image thumbnails to show up in 2 rows horizontal with the larger image above the thumnails.


I'm not sure I fully understand what you're trying to accomplish. What is the larger image?
All the best,
Chris

Re: [k4tlove] Gallery

By Chris - November 30, 2009

Hi k4tlove,

To get your images to display in a 2-column list with captions, you can use a table and add some PHP code to start a new table row after every second image. For example:

<table>
<tr>
<?php foreach ($listingsRecord['uploads'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>
<td>
<a href="<?php echo $upload['urlPath'] ?>">
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="1" alt="Photo" />
</a><br/>
<?php echo $upload['info1'] ?>
</td>
<?php endif ?>
<?php endforeach ?>
</tr>
</table>


The gallery on the website you directed me to uses [url http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm]Image Thumbnail Viewer II[/url].

I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Gallery

[cool] That worked great. Now if I have 2 columns how would I get the larger image to open on the same page in a frame next to the 2 columns as oppose to it opening in a new window. Right now when you click on the thumbnail to view it larger it opens in a new window. I would like it to open on the same page in a frame next to the thumbnails and when you mouse over the thumbnail that picture appears in the frame.

Re: [k4tlove] Gallery

By Chris - November 30, 2009

Hi k4tlove,

You'd need to do something like that with Javascript, for example, with the Image Thumbnail Viewer II script. Unfortunately we don't provide support for Javascript, however, we do offer this through our consulting service. If you are interested, please visit [url interactivetools.com/consulting]our consulting page[/url].
All the best,
Chris