some help
5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 25, 2011 (RSS)
By efi-revivo - May 24, 2011
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
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
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
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
about the plugin there is something free to do it?
maybe in the sql?
Re: [efi-revivo] some help
By Jason - May 25, 2011
Yes, you could do it directly through sql if you're comfortable with that. We have a free MySQL consol plugin located here:
http://www.interactivetools.com/add-ons/detail.php?MySQL-Console-1011
Here is a MySQL manual page describing how to do this:
http://dev.mysql.com/doc/refman/5.1/en/insert-select.html
NOTE: you should only try this if you are comfortable using MySQL. You should ALWAYS make a complete backup of your database and files before attempting to execute sql commands directly on the database.
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/