Welcome, Guest. Please Login or Register.
November 28, 2024, 10:30:22 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Get the calendar events for x days « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Get the calendar events for x days  (Read 230 times)
Thomas
Full Member
***
Posts: 203


WWW
Get the calendar events for x days
« on: September 02, 2002, 11:11:35 PM »
Reply with quote

I need the ability to get the calendar events for the x next days out on my frontpage with ssi.

I have not seen any mods for this. If there is a way of doing so pleas tell, if not it would be nice if some of you could make it.

/MR.T
Logged
Brock
Noobie
*
Posts: 18


Re:Get the calendar events for x days
« Reply #1 on: September 03, 2002, 07:31:01 PM »
Reply with quote

Here's some simple code to grab the entire calendar for you - adding the other functionality you want should be simple with this base.

<?php

$types_to_register 
= array('GET','POST','COOKIE','SESSION','SERVER');
  foreach (
$types_to_register as $type) {
    
$arr = @${'HTTP_' $type '_VARS'};
    if (@
count($arr) > 0) {
      
extract($arrEXTR_OVERWRITE);
    }
  }

function 
page_top() {
  print(
"<html>\n<head>\n <title>Yabbse Calendar</title>\n");
  print(
"</head>\n");
  print(
"<body font size=4>\n\n");
}

function 
list_calendar() {

  print(
"<table border=4 bordercolorlight=#333399 bordercolordark=#333399");
  print(
" cellpadding=3 width='90%'>\n");
  print(
" <th align=left>Event</th>\n");
  print(
" <th align=left>Date</th>\n");

  
$result mysql_query("SELECT * from yabbse_calendar order by month,day,year");

  while (
$myrow mysql_fetch_row($result)) {
    
/* Schema :
     *
     *   id int(10) unsigned NOT NULL auto_increment,
     *   id_board int(10) unsigned NOT NULL default '0',
     *   id_topic int(10) unsigned NOT NULL default '0',
     *   title char(30) NOT NULL default '',
     *   id_member int(10) unsigned NOT NULL default '0',
     *   month tinyint(4) NOT NULL default '0',
     *   day tinyint(4) NOT NULL default '0',
     *   year smallint(6) NOT NULL default '0',
     *   PRIMARY KEY  (id),
     *   KEY idx_year_month (year,month)
     *
     * To make a link to the relevant topic posting on your yabbse board,
     * build the urls as such :
     * <url>/index.php?board=id_board;action=display;threadid=id_topic
     *
    */

    
printf("<tr><td>%s</td>"$myrow[3]);
    
printf("<td>%02d/%02d/%04d</td></tr>\n"$myrow[5],$myrow[6],$myrow[7]);
  }
  print(
"</table>\n");
}


error_reporting (E_ALL E_NOTICE);

$dbcon mysql_connect('localhost''username''password');
mysql_select_db('yabbse');

page_top();
list_calendar();
print(
"<br>\n");
print(
"<html>");
?>


Obviously, replace relevant parts of this with the values for your system.
« Last Edit: September 03, 2002, 07:31:56 PM by Brock » Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Get the calendar events for x days « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.045 seconds with 20 queries.