Easy PHP Calendar - We really take care of your dates!


Go Back   Easy PHP Calendar > Pre-Sales Questions > General

General Get answers to your questions before purchasing the Easy PHP Calendar.

Closed Thread
 
Thread Tools Search this Thread Display Modes

Display multiple months
Old 05-29-2005, 10:30 PM   #1
keithh0427
Calendar User
 
keithh0427 is offline
Join Date: Apr 2005
Posts: 10
Default Display multiple months

Is there a way to display last month, this month, and next month? Similar to working on the events page of setup.
 

Old 05-30-2005, 05:55 AM   #2
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,969
Default

If you reset the $mo variable before calling the listing module, it is possible. Add this
PHP Code:
$mo $mo 1;
if (
$mo == 0) {
    
$mo 12;
    
$yr $yr 1;
}
$listMonths 3
That should do the trick.
 

Old 05-31-2005, 08:29 PM   #3
Arthur
Calendar User
 
Arthur is offline
Join Date: May 2005
Posts: 6
Default

Thanks, ve9gra.

Just one question: in what file/module is this code added, and where? I'd be grateful for fuller info as I'm a real n00b. Ta lot.
 

Old 05-31-2005, 08:31 PM   #4
keithh0427
Calendar User
 
keithh0427 is offline
Join Date: Apr 2005
Posts: 10
Default

This code would be placed in the HTML page that is calling the calendar.
 

Old 05-31-2005, 08:37 PM   #5
Arthur
Calendar User
 
Arthur is offline
Join Date: May 2005
Posts: 6
Default

Thanks.
I must be really thick. Just tried adding this text but it still shows the single month, with the text across the top in one line, asin this test:

www.williamson.co.za/test1.php
 

Old 05-31-2005, 08:56 PM   #6
keithh0427
Calendar User
 
keithh0427 is offline
Join Date: Apr 2005
Posts: 10
Default

You need to wrap it all in php

Try this:

<?php
$mo = $mo - 1;
if (
$mo == 0) {
$mo = 12;
$yr = $yr - 1;
}
$listMonths = 3;
?>

If you need this month and next month, it would be:

<?php
$mo = $mo + 1;
if ($mo == 13) {
$mo = 1;
$yr = $yr + 1;
}
$listMonths = 3;
?>


 

Old 05-31-2005, 09:05 PM   #7
keithh0427
Calendar User
 
keithh0427 is offline
Join Date: Apr 2005
Posts: 10
Default

Just to be safe, here's some live code that I'm using.

<?php
echo "<table><tr>";
$noNav = 1;
echo "<td align=\"center\">";
require("calendar/calendar.php");
$mo++;
if (++$mo > 12) {
$mo = 1;
$yr++;
}

echo "</td>";
echo "<td align=\"center\">";
require("calendar/calendar.php");
$mo++;
if (++$mo > 12) {
$mo = 1;
$yr++;
}

echo "</td>";
echo "<td align=\"center\">";
require("calendar/calendar.php");
echo "</td>";
echo "</tr></table>";
?>

This will display 3 months in a horizontal fashion. You can increase the distance between the months by varying the table parameters such as padding, etc.

Also, note the use of $noNav = 1;. You will need to use that to turn off the navigation beneath each calendar. Pretty messy if you don't.
 

Old 05-31-2005, 09:27 PM   #8
keithh0427
Calendar User
 
keithh0427 is offline
Join Date: Apr 2005
Posts: 10
Default

Arthur,

Here's a complete .php file that I just tested.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<?php $CSS=1; require("calendar/calendar.php"); ?>
</head>

<body>
<?php $OL=1; require("calendar/calendar.php"); ?>
<?php
echo "<table cellspacing='0' cellpadding='35'><tr>";
$noNav = 1;
echo "<td align=\"center\">";
require("calendar/calendar.php");
$mo++;
if ($mo > 12) {
$mo = 1;
$yr++;
}
echo "</td>";
echo "<td align=\"center\">";
require("calendar/calendar.php");
$mo++;
if ($mo > 12) {
$mo = 1;
$yr++;
}
echo "</td>";
echo "<td align=\"center\">";
require("calendar/calendar.php");
echo "</td>";
echo "</tr></table>";
?>

<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
 

Old 05-31-2005, 09:54 PM   #9
keithh0427
Calendar User
 
keithh0427 is offline
Join Date: Apr 2005
Posts: 10
Default

Arthur,

Take a look at http://alifetimeoflove.org/calendar.php

Hopefully, that's what your looking for. The months change by three, cut can easily be setup to change by one.
 

Old 06-01-2005, 06:05 AM   #10
ve9gra
Support Team
 
ve9gra's Avatar
 
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,969
Default

So sorry Arthur... I had misunderstood your inquery. I thought you wanted to have 3 months displayed in the listing module and only the current month for the calendar.

Here's the full code to what you want to do. Please make sure you adjust the paths accordingly to your installation.

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Calendar</title>
<?php $CSS=1; require("calendar/calendar.php"); ?>
</head>

<body>
<?php $OL=1; require("calendar/calendar.php"); ?>
<?php
import_request_variables
("gp");
if (!isset(
$yr)) $yr=date("Y");
if (!isset(
$mo)) $mo=date("n");
$lastMonth $mo 1;
$lastYear $yr;
if (
$lastMonth == 0) { $lastMonth 12$lastYear--; }
$curMonth $mo;
$curYear $yr;
$nextMonth $mo 1;
$nextYear $yr;
if (
$nextMonth == 13) { $nextMonth 1$nextYear++; }

echo 
"<table cellspacing='0' cellpadding='35'><tr>";
$noNav 1;
echo 
"<td align=\"center\">";
$mo $lastMonth;
$yr $lastYear;
require(
"calendar/calendar.php");
echo 
"</td>";
echo 
"<td align=\"center\">";
$mo $curMonth;
$yr $curYear;
require(
"calendar/calendar.php");
echo 
"</td>";
echo 
"<td align=\"center\">";
$mo $nextMonth;
$yr $nextYear;
require(
"calendar/calendar.php");
echo 
"</td>";
echo 
"</tr></table>";
?>
</body>
</html>

Last edited by ve9gra; 06-01-2005 at 06:42 AM.
 
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple months shown at once? flyingMoose General Support 5 10-08-2006 01:33 PM
how does one display multiple small calendars? Gordon Werner General Support 3 05-09-2005 01:13 PM
Display two months in same page bengao General Support 5 08-12-2004 01:04 PM
Multiple Months - Newbie Bigup_Yaself General Support 1 02-16-2004 04:46 PM



All times are GMT -4. The time now is 04:57 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright 2009 NashTech, Inc.

| Home | Register | Today's Posts | Search | New Posts |