PDA

View Full Version : Use popup link in other part of website


Napoleon
01-02-2006, 04:32 PM
Hi,

I've been playing around with this great calendar and created a shortlist of upcoming events that shows up under the actual calendar.
To do this, I query the database for the date and the description. I managed to feed this data into another great free newsticker.
My question is how can I regenerate the link to launch the popup also from this scrolling text.
The link in the actual calender looks like this:
/cal/popups/escalEV.php?ev="+ev+"&readFile=0&readSQL=1
where the bold part is a number that somehow is being calculated.
It would be great to be able to calculate this number myself.
You can take a look at my the page where I'm testing it now:
http://www.maxkarting.be/index_test.shtml

For those who are interested in the scrolling text should take a look at http://www.smartmenus.org/other.php

Brian
01-02-2006, 05:42 PM
ev denotes the day number for the events being displayed. It appears that you're using Version 5, so the number would coorepond to the number of days since the Unix timestamp began.

Napoleon
01-03-2006, 05:33 AM
Hi Brian,

thanks for the quick reply.
You're correct, I'm using version 5.
For the event sheduled on January 14, the link is http://www.maxkarting.be/cal/popups/escalEV.php?ev=13162&readFile=0&readSQL=1
So 13162 would be the unix timestamp. Normally timestamp is in seconds, but when I convert to days and take the timezone into account, it is correct. Unix timestamp began at January 1st 1970. Since then 13162 days passed.
I'll try to find out a way to convert the date to this particular format. Or if you have a ready-made solution you're welcome :)

If this has changed/improved in a newer version please tell me. I do understand supporting the older versions has its effect on improving the new versions.

Stephan

Napoleon
01-03-2006, 04:51 PM
OK,

I've just finished.

These are the lines that did the job:
list($y,$m,$d) = split('[-]',$startdate);
$tsplit=mktime(1,0,0,$m,$d,$y)/86400;

Notice the 1. Since my timezone is GMT+1, I guess this prevents from linking to the wrong date.

Then I added the popupevent javascript you use:

<script language="JavaScript" type="text/JavaScript">
<!--
function popupEvent(ev,w,h) {
var winl=(screen.width-w) / 2;
var wint=(screen.height-h) / 2;
win=window.open("/cal/popups/escalEV.php?ev="+ev+"&readFile=0&readSQL=1","ESCalendar","scrollbars=yes,status=no,location=no,toolbar=no,me nubar=no,directories=no,resizable=yes,width="+w+",height="+h+",top="+wint+",left="+winl+"");
if (parseInt(navigator.appVersion) >=4) { win.window.focus();}
}
//-->
</script>

And that's it.

Thanks again for the quick reply. :clap:


Stephan