help with a new details page

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 18, 2010   (RSS)

Hello guys,

We are redesigning our details pages and are having some trouble with the coding of some new features.

1. We want to add a section on a details page of Other Rental Listings that a user owns. For example, you a viewing a property that Bob has listed on our site (property #1). We want to display in a box, property #2, #3 and #4 (pic and name of property)that Bob owns.

This code pulls 1 of Bob's properties:
<?php require_once "../cmsAdmin/lib/viewer_functions.php";

list($commercial_rental_propertyRecords, $commercial_rental_propertyMetaData) = getRecords(array(
'tableName' => 'commercial_rental_property',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$commercial_rental_propertyRecord = @$commercial_rental_propertyRecords[0]; // get first record


Can we just add another chunk of code on the same page to pull other listings or will we need to make this an include file?
list($commercial_rental_propertyRecords, $commercial_rental_propertyMetaData) = getRecords(array(
'tableName' => 'commercial_rental_property',
'where' => createdByUserNum = (Bob's user num),
));


Finally, the last issue we were having with this was begin able to write the correct code for the WHERE statement. I assume we will have to define a variable $user=$record['createdByUserNum'];
and use this where statement in the code above

'where' => createdByUserNum = $user,
But I was getting undefined index errors when I used "record" and/or "commercial_rental_propertyRecord" when trying to define the variable. I can get the createdByUserNum to display on the page just fine, but trying to pull it into a variable was not working.

2. Similar to the above feature, but a little different.
We want to display related rental listings from all users. So for Bob's Commerical Rental Property we want to display, in a separate box, electronic rentals, office furniture, etc that have a cities_serviced_keyword that matches the city that Bob's property is in. I again believe that this will be a where statement for each of the categories that we choose to display for this section. Such as
where => ' cities_serviced LIKE city',
(Our cities_services field is a text box that lists any cities a company services. Each city is separated by a comma. ) I not too familiar with the LIKE function and not sure if that is the correct/best way to do it.

Your help is greatly appreciated as always.
Thanks!
Jason Glass