Page list by city

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

I have done this many before seems like this cms version is different .....trying to get city pages -this lists all the cities not just Gilbert

http://mesaverderentals.com/2012/RentalList.php?City=Gilbert

and when I stick a "where" in a gilbert only page it I get nothing .. not sticking it in there I get everything like above link

// load records from 'rentals'
list($rentalsRecords, $rentalsMetaData) = getRecords(array(
'tableName' => 'rentals',
'loadUploads' => true,
'allowSearch' => false,
'where' => "City = 'Gilbert'",
));

http://mesaverderentals.com/2012/GilbertRentalList.php?City=Gilbert

Please help.

and can you tell me whats the differnce between

City:values and City:lables??????? First time seeing these.



thanks
Patricia

www.thenetgirl.com

Re: [thenetgirl] Page list by city

Hi,

For the getRecords statement with a where clause there are a couple of things you could try:

I notice that you have a capital letter on city in your where clause, although you can save a field name with a capital letter, usually CMS builder will set the field up to be completely lowercase, so I'd double check that is correct.

Is the city being generated by a list field that uses the 'get options from database (advanced)' to generate the list of cities? If it is then difference between values and labels is that the value is what is stored in the database field and the labels is meant to be a more descriptive name that you might want to display on the page. Your where clause needs to contain the cities value and not its label.

If neither of these work, could you post up what is returned after you add this code:

// load records from 'rentals'
list($rentalsRecords, $rentalsMetaData) = getRecords(array(
'tableName' => 'rentals',
'loadUploads' => true,
'allowSearch' => false,
));

showme($rentalsRecords[0]);


It should output what is being stored in the first value of the $rentalsRecord variable.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [thenetgirl] Page list by city

Hi,

Just a guess...

If you're pulling list values from a database using the record number 'num' field for option values and a text field for option labels, you may have to add the pseudo field 'your_field:label' to your filter, instead of just 'your_field' so that it returns a text value instead of a number.

Use <?php showme($record['your_field']);exit; ?>

And in your list records call, 'debugSql' => true,

to help see what's going on.

Good luck,

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: [greg] Page list by city

By thenetgirl - October 26, 2012 - edited: October 26, 2012

Oh that didnt work at all

// load records from 'rentals'
list($rentalsRecords, $rentalsMetaData) = getRecords(array(
'tableName' => 'rentals',
'loadUploads' => true,
'allowSearch' => false,
));


http://mesaverderentals.com/2012/GilbertRentalList.php?City=Gilbert



this is the code City is correct

<b>Record Detail</b><br/>
Record Number: <?php echo htmlencode($detailRecord['num']) ?><br/>
Move In (value): <?php echo $detailRecord['move_in'] ?><br/>
Move In (label): <?php echo $detailRecord['move_in:label'] ?><br/>
Move In Pending : <?php echo htmlencode($detailRecord['move_in_pending']) ?><br/>
NOTICE: <?php echo htmlencode($detailRecord['notice']) ?><br/>
Cross Street: <?php echo htmlencode($detailRecord['cross_street']) ?><br/>
Map Link: <?php echo htmlencode($detailRecord['map_link']) ?><br/>
Address: <?php echo htmlencode($detailRecord['address']) ?><br/>
City (values): <?php echo join(', ', $detailRecord['City:values']); ?><br/>
City (labels): <?php echo join(', ', $detailRecord['City:labels']); ?><br/>
State: <?php echo htmlencode($detailRecord['state']) ?><br/>
Zip: <?php echo htmlencode($detailRecord['zip']) ?><br/>
Bedroom (value): <?php echo $detailRecord['bedroom'] ?><br/>

attached the file

thanks
Patricia

www.thenetgirl.com
Attachments:

gilbertrentallist.php 4K

Re: [gkornbluth] Page list by city

Not trying to use record number just trying to ge the cities to each have there own page.
Patricia

www.thenetgirl.com

Re: [thenetgirl] Page list by city

Not sure, but wouldn't allowSearch' => false, stop the city value from being searched?
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] Page list by city

Perfect --set to true

and removed

showme($rentalsRecords[0]);
Patricia

www.thenetgirl.com