Commas and two Detail viewers from one section

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 30, 2010   (RSS)

Re: [fleff] Commas and two Detail viewers from one section

By Jason - July 30, 2010

Hi Farnham,

In regards to your first question, it sounds like a multiselect drop down would be the best solution for you. When more than one option is selected, CMS Builder stores them as a string separated by tabs (\t). It also puts a tab character at the beginning and end of the string. Here is an example of how you could get a comma in between the options:

$record['rental_period'] = trim($record['rental_period'],"\t");
$record['rental_period'] = str_replace("\t",",",$record['rental_period']);


The first line removes the tab from the front and end of the string. The second line replaces all the remaining tab characters with commas. You can then output the variable $record['rental_period'] where ever you want.

As for the second question, it depends on how you set it up. I think the best thing would be to have 2 check boxes: 1 for "Rental" 1 for "For Sale". On different pages, you can then decide which fields to display based on which check boxes are selected.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Commas and two Detail viewers from one section

By fleff - July 30, 2010

Thanks, Jason. The commas work fine with the code you posted.

As to the the viewer information, I have a Status dropdown field:

For Sale
Sold
For Rent
Rented

Do you mean to apply if statements based on the selected option to show or hide the proper fields for that status on the details page? Sounds good. I'll try it.

Farnham