Sorting
2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 13, 2010 (RSS)
By KCMedia - April 9, 2010
I have this page that list all these bikes i need to be able to sort them by the info3 field in the CMS builder for uploads how would i go about this as i need the smallest CC bikes first to largest.
This is a single page with lots of uploaded images
This is a single page with lots of uploaded images
Thanks
Craig
KC Media Solutions
www.kcmedia.biz
Craig
KC Media Solutions
www.kcmedia.biz
Re: [kcmedia] Sorting
By Jason - April 13, 2010
Hi,
Try this. Near the top of the page, we're going to put in this code:
Next, right before this line:
<?php foreach ($learner_legalRecord['bikes'] as $upload): ?>
Put in this code:
Give this a try and let me know how it goes.
Try this. Near the top of the page, we're going to put in this code:
<?php
function callback($a, $b) {
global $key;
if ($a[$key] == $b[$key]) return 0;
return $a[$key] > $b[$key] ? 1 : -1;
}
?>
Next, right before this line:
<?php foreach ($learner_legalRecord['bikes'] as $upload): ?>
Put in this code:
<?php
$key = 'info3';
uasort($learner_legalRecord['bikes'], 'callback');
?>
Give this a try and let me know how it goes.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/