Sie sind nicht angemeldet.

bazaar

Schüler

  • »bazaar« ist der Autor dieses Themas

Beiträge: 57

Wohnort: Bourgogne, Savoie, Ardèche, France..

Beruf: Photography and Virtual tours

  • Nachricht senden

1

Donnerstag, 24. Februar 2011, 23:14

Get server date to make an action?

Hello everybody,

I wonderer if it was possible with krp, to get the host webserver date, and create krpano actions with it..?

Just something like display some plugins at one date or another...

Thank you!

regards,

Xavier

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Donnerstag, 24. Februar 2011, 23:28

you could let krpano execute a js function, which returns the date

http://www.mediacollege.com/internet/javascript/date-time/

then do an if statement to do some actions.

bazaar

Schüler

  • »bazaar« ist der Autor dieses Themas

Beiträge: 57

Wohnort: Bourgogne, Savoie, Ardèche, France..

Beruf: Photography and Virtual tours

  • Nachricht senden

3

Donnerstag, 24. Februar 2011, 23:39

Seems interesting,

i have some developement techniques limits..
Does these lines to be inserted in the html code, or in the swfkrpano.js?

Thanks!

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

4

Freitag, 25. Februar 2011, 10:49

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<krpano>
   <events onxmlcomplete="parsedate()" />
   <action name="parsedate">
          js(get_date());
          if(get(day) == '24',
               if(get(month) == '02',
                  if(get(year) == '2011',  
                      trace('Jeej, today is 24-02-2011');
                  );
               );
          );
    </action>
</krpano>


html:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function get_date()
{
	var krpanoObj = document.getElementById('krpanoSWFObject');
	
	var date = new Date();
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;
	
	krpanoObj.set('day', day);
	krpanoObj.set('month', month);
	krpanoObj.set('year', year);
}


Sorry Im a bit rusty with xml if statements, so mind the typos. But you get the idea :)

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

5

Freitag, 25. Februar 2011, 10:54

btw this gets the users date, webservers date probally needs serverside script like php http://php.net/manual/en/function.date.php

bazaar

Schüler

  • »bazaar« ist der Autor dieses Themas

Beiträge: 57

Wohnort: Bourgogne, Savoie, Ardèche, France..

Beruf: Photography and Virtual tours

  • Nachricht senden

6

Freitag, 25. Februar 2011, 11:36

Thank you very much Zephyr,
i'll try it immediatly!

bazaar

Schüler

  • »bazaar« ist der Autor dieses Themas

Beiträge: 57

Wohnort: Bourgogne, Savoie, Ardèche, France..

Beruf: Photography and Virtual tours

  • Nachricht senden

7

Freitag, 25. Februar 2011, 15:03

Hello,
well, it seems that i can't configure this code to my files..
i will take a look better next week...
Thank you very much!
:)
Xavier

Ähnliche Themen