[Pro] Redirect between dates in panes caroussel possible

I assume this gets complicated… I have used the carousel as a scrolling agenda: http://www.dehavenkom.nl/agenda.php Obviously it is a bit annoying when the pane goes to January in the middle of the summer :-). Just wonder, is it possible to have it re-directed to the appopriate pane like Tim’s action ‘Redirect between Dates’ - which is for pages of course. Or is there another ‘trick’?

Thanks,

Paul


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If you made your agenda one month per carousel pane, you could do this pretty simply. Just name each pane something like agenda_04, agenda_05, agenda_12 for the ISO month numbers, and then in PHP you would use date(‘m’,time()) to get the current month in the same format. I’ll dig out the correct bit of JavaScript you’ll need to echo into your page with PHP in an hour or so.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Wow… yes… wow… let’s go for it!!! I’ll change the layout the in 12 months. Wow…!

Paul


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Okay, there’s no way to add the JavaScript that would force the carousel to a particular pane without editing the Action, but there is another trick you can add pretty simply. In your carousel page, open the Page / HTML Markup dialog and move to the Before HTML section. Paste in the following:

<?php
if(!isset($_SERVER['QUERY_STRING'] || strlen($_SERVER['QUERY_STRING']) < 1){
header('Location: ' . $_SERVER['REQUEST_URI'] . '?agenda_' . date('m',time()));
exit;
}
?>

What this should do (haven’t tested it here) is read the URI (the entire request string) look for a querystring component, and if there isn’t one, it will add one pointing to the current month in the agenda_NN naming scheme and redirect the page to that URI. This should force the carousel to swing over to that pane.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ah… so no need to change the lay-out then… I can stick to 2 months at a page, right?
I’ll give it a try. Thanks Walter! You did it again… :slight_smile:

Paul


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No, you will need to change it, because you won’t have a pane per month (what the URI is going to ask you for) in that case.

Another thing you could try is to re-write the PHP sample to pick the correct pane based on the current month:

switch(date('m',time()){
    case '01':
    case '02':
    $pane = 'janfeb';
    break;
    case '03':
    case '04':
    $pane = 'marapr';
    break;
    
    //et cetera
    
    default:
    $pane = 'novdec';
    break;
}

and then use the same code but substitute $pane in the querystring rather than ‘agenda_’ + the current month. Obviously, change your pane names or the code example above to match one another. All this trick does is force the pane name you add after the ? to be set as the initial selection.

Make sense?

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hmmmm… it sure will make sense to you :slight_smile: But I need to do some study first. It will take me a while but that is ok!
I thought I could get away with my design but the client had other thoughts… But I understand he wants it like that…

Warm Regards!

Paul


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options