Display order of schedules | The Conference Plugin | Forum

 

Current User: Guest
Login
Members
Please consider registering


Lost Your Password?

Search Forums:

 








Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Display order of schedules

Reply to Post
Add a New Topic
No Tags
User Post

11:48 am
February 26, 2013

BenCrowley

Member

posts 14

If I look at the schedule for a 4 day event, with an spearate schedule for each day

 

 

the links at the top of the page seem to be alphabetically ordered instead of chronilogical.

 

Please can you let me know how to list the days in chronilogical order?

10:18 pm
February 26, 2013

Top Quark

Barrie, ON

Member

posts 317

Hi Ben,

I responded to a similar question about this for The Explorer App in an email, and since sending it, I've thought of a more elegant way.  In the functions.php file for your theme (or any customization plugin you might have going), add the following:

function my_sorter($a,$b){
 if($a == "Update Day"){
 return -1;
 }
 elseif($b == "Update Day"){
 return 1;
 }
 elseif ($a == "Allied Professionals"){
 return 1;
 }
 elseif($b == "Allied Professionals"){
 return -1;
 }
 else{
 return strcmp($a,$b);
 }
}

add_filter('Smarty_Instance_resource_name','my_Smarty_resource_name',12,2); 
function my_Smarty_resource_name($resource_name,$args){
 $smarty = $args[0];
 switch($resource_name){
 case 'festivalapp.schedule.tpl':
 case 'ifestivalapp.table.tpl':
 $parm = ($resource_name == 'festivalapp.schedule.tpl' ? 'ScheduleNames' : 'Schedules');
 $ScheduleNames = $smarty->get_template_vars($parm);
 uasort($ScheduleNames,'my_sorter');
 $smarty->assign($parm,$ScheduleNames);
 break;
 }
 return $resource_name;
}

Basically what you're doing here is hooking into the piece of the code that displays the smarty template.  If you're displaying either festivalapp.schedule.tpl (the template for the schedules page) or ifestivalapp.table.tpl (the template for the Explorer App), then you're going to resort (using the function uasort) the Schedule Names).  

I think that's the best way to approach sorting schedule names by something other than alphabetical order.

Cheers
Trevor 

No Tags
Reply to Post

Reply to Topic:
Display order of schedules




Guest Name (Required):

Guest Email (Required):

Smileys
Confused
Cool
Cry
Embarassed
Frown
Kiss
Laugh
Smile
Surprised
Wink
Yell
Post New Reply

Guest URL (required)

Math Required!
What is the sum of:
9 + 10
   



© Simple:Press