some help

5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 25, 2011   (RSS)

By efi-revivo - May 24, 2011

Hello,

I have some question:

1. I have category field with pulldown (multi value)
I want to show on the record page only the first category.
how can i do it?

when i use this code:
<?php echo join(', ', getListValues('listing', 'category', $listingRecord['category'])); ?>

its show all the category like: 54, 14, 55
i need to see only the first one.


2. I have servel section with the same fields and I want to convert them to one section.
how can i copy all the records to one section?

Thanks,
Efi

Re: [efi-revivo] some help

By gkornbluth - May 24, 2011

Hi Efi,

Regarding item 2 - Have you looked into using Navicat, or the CSV import and export plugins?

regarding Item 1) have you tried implementing the 'limit' => '1',

(I have no idea if this would work for you, but it came to mind.)

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: [efi-revivo] some help

By Jason - May 24, 2011

Hi,

1) getListValues returns an array of values. So if we remove the join() function, we can capture and manipulate the array directly like this:

<?php
$listValues = getListValues('listing', 'category', $listingRecord['category']);

if ($listValues) {
echo $listValues[0]; // display first selected value
}

?>


2) I would agree with Jerry, using the CSV Export and then the CSV Import plugins would make the process of combining your sections into 1 a lot quicker if you have a large number of records. If you only have a small number of records, you may want to consider re-adding your records manually.

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] some help

By efi-revivo - May 25, 2011

thanks it's working.

about the plugin there is something free to do it?
maybe in the sql?