Page 1 of 1
calendar
Posted: Thu Apr 19, 2007 4:56 am
by kpraman
I have downloaded a calendar from
http://www.cascade.org.uk/software/php/ ... /index.php
Can any pls tell me how to use getDateLink with an example?
Posted: Thu Apr 19, 2007 5:13 am
by aaronhall
Funny, the guy that wrote the script already did that... go figure:
http://www.cascade.org.uk/software/php/ ... inking.php
Posted: Thu Apr 19, 2007 5:19 am
by kpraman
i tried, its not working
Posted: Thu Apr 19, 2007 5:26 am
by kpraman
This is how i wrote,
Code: Select all
class MyCalendar extends Calendar
{
function getDateLink($day, $month, $year)
{
// Only link the first day of every month
$link = "";
if ($day == 1)
{
$link = "first.php";
}
return $link;
}
}
$cal=new Calendar;
echo $cal->getDateLink(1, 4, 2007)
Posted: Thu Apr 19, 2007 5:39 am
by aaronhall
Posted: Thu Apr 19, 2007 5:56 am
by kpraman
Code: Select all
class MyCalendar extends Calendar
{
function getDateLink($day, $month, $year)
{
// Only link the first day of every month
$link = "";
if ($day == 1)
{
$link = "first.php";
}
return $link;
}
}
$cal=new MyCalendar;
echo $cal->getDateLink(1, 4, 2007);
OUTPUT: first.php
Posted: Thu Apr 19, 2007 5:59 am
by aaronhall
Looks like you got it working then
Posted: Thu Apr 19, 2007 6:01 am
by kpraman
No. I am only seeing the text, 'first.php'
Posted: Thu Apr 19, 2007 6:11 am
by aaronhall
Right, that's what it's supposed to do.
Posted: Thu Apr 19, 2007 6:12 am
by kpraman
How do i display calendar with link?
Posted: Thu Apr 19, 2007 6:28 am
by aaronhall
I'd just be reading the documentation for you and regurgitating it here. Read:
http://www.cascade.org.uk/software/php/ ... /index.php
Posted: Thu Apr 19, 2007 7:47 am
by bert4
Well it took me a while to figure it out
You need to understand that the function getDateLink is used by the calendar class to find out if a link needs to be displayed.....
So, if you have dates that need to be linked, they have to be retrieved by this function.
This works:
Code: Select all
<?
require('calendar.php'); // the calendar class
class MyCalendar extends Calendar
{
function getDateLink($day, $month, $year)
{
if ($day == 1 AND $month == 4 AND $year == 2007) { $link = "first.php"; }
if ($day == 10 AND $month == 4 AND $year == 2007) { $link = "tenth.php"; }
return $link;
}
}
$cal=new MyCalendar;
echo $cal->getCurrentMonthView();
?>