Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 09-27-2003, 11:28 AM
Zlaxzzor Zlaxzzor is offline
 
Join Date: Mar 2003
Location: Sweden
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vB3 calendar showing on non vb page

Ok... I would really need a hack for the vB3 calendar. What I want it to do is to show for example the 5 comming happenings on my site (not on vb). Since you can have multiple different calendars in vB3 it would be really great if someone also could fix so the script only reads from one of the calendars.
Reply With Quote
  #2  
Old 09-27-2003, 11:12 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zlaxzzor
Ok... I would really need a hack for the vB3 calendar. What I want it to do is to show for example the 5 comming happenings on my site (not on vb). Since you can have multiple different calendars in vB3 it would be really great if someone also could fix so the script only reads from one of the calendars.
no vb3 hacks allowed yet, I believe
Reply With Quote
  #3  
Old 09-27-2003, 11:37 PM
insanctus's Avatar
insanctus insanctus is offline
 
Join Date: Feb 2003
Location: Michigan
Posts: 582
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No vb3 hacks untill rc, it is posted.
Reply With Quote
  #4  
Old 09-28-2003, 12:29 AM
Zlaxzzor Zlaxzzor is offline
 
Join Date: Mar 2003
Location: Sweden
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh, that's a pity :|
Reply With Quote
  #5  
Old 10-08-2003, 03:05 AM
Clegg Clegg is offline
 
Join Date: Dec 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey man I gotcha covered

this is NOT a hack as many people seem to think you are simply reading from the MYSQL DB data that VB3 has put there... So chill you damn nazi's

www.midwestlan.com almost everything on that site is tied to vb3 and not one VB3 file has been modified, all just custom PHP scripts and SQL calls. in the top right hand corner you can see a listing of coming events. heres my code for it:

PHP Code:
<?php 
include('./global.php'); 
$events $DB_site->query ("SELECT UNIX_TIMESTAMP() AS dateline, dateline_from, eventid, title 
                           FROM event
                           WHERE calendarid = 1 AND dateline_from > UNIX_TIMESTAMP() AND userid = 1 

                           ORDER BY dateline_from LIMIT 4"
); 
if (
$DB_site->num_rows($events)) { 
echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
 "
;
    while (
$event $DB_site->fetch_array($events)) { 

$timestring=$event['dateline_from']; 
$dateevent=date("M j,Y",$timestring); 
    echo 
"
<tr>
 <td align=\"center\" width=\"80\" bgcolor=\"101010\"><font face=\"verdana, arial, helvetica\" size=\"1\" color=\"888888\">
$dateevent</font></td>
 <td align=\"center\" bgcolor=\"101010\" width=\"183\"><font face=\"verdana, arial, helvetica\" size=\"1\"><b><a href='http://www.midwestlan.com/forums/calendar.php?do=getinfo&e=
$event[eventid]&c=1'>$event[title]</a></b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr>
"

  }
//} 
} else { 
  echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#000000\"><font face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b>No Events Upcoming Currently</b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr> "
;

echo 
"</table>";
?>
Ive modified the events table in the SQL DB to add a few fields since I have a registration system I have integrated to it so that vb's calendar shows events that are coming up for other lans and my own. Lets break this down:

PHP Code:
$events $DB_site->query ("SELECT UNIX_TIMESTAMP() AS dateline, dateline_from, eventid, title 
                           FROM event
                           WHERE calendarid = 1 AND dateline_from > UNIX_TIMESTAMP() AND userid = 1 

                           ORDER BY dateline_from LIMIT 4"
); 
What this does is reads the eventid, title, dateline_from, from teh data base. and then validates its a public item (calendar id = 1) and that it happens before the current time. This also limits the ones that are displayed publicly to my user ID only. ( user ID 1) Because now the registration system posts public events, I dont want them showing. It then sorts them by the dateline_from so the soonest is listed first, and it limits that to 4 entries.

PHP Code:
if ($DB_site->num_rows($events)) { 
echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
 "
;
    while (
$event $DB_site->fetch_array($events)) { 

$timestring=$event['dateline_from']; 
$dateevent=date("M j,Y",$timestring); 
    echo 
"
<tr>
 <td align=\"center\" width=\"80\" bgcolor=\"101010\"><font face=\"verdana, arial, helvetica\" size=\"1\" color=\"888888\">
$dateevent</font></td>
 <td align=\"center\" bgcolor=\"101010\" width=\"183\"><font face=\"verdana, arial, helvetica\" size=\"1\"><b><a href='http://www.midwestlan.com/forums/calendar.php?do=getinfo&e=
$event[eventid]&c=1'>$event[title]</a></b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr>
"

  } 
This above essentially diplays the header and then all teh events, I am prettys ure you can make out what its doing.

PHP Code:
} else { 
  echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#000000\"><font face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b>No Events Upcoming Currently</b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr> "
;

echo 
"</table>"
and if there isnt any items to display it still shows the header and "No Events".

Works like a charm with Vb3. Enjoy!

Now all I need to do is find out how to use the parse bbcode function in vb3 for my site news... theres no formatting that I can access for post data like I used to be able to before in vb2... that was the whole reason I came snooping today
Reply With Quote
  #6  
Old 09-04-2004, 04:16 PM
ashy ashy is offline
 
Join Date: Dec 2001
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We have a few scripts that get latest posts etc that get written to a js file for including on non-vb pages. After upgrading from 2 to latest 3 these all work except for the one accessing the calendar.

The php routine we have always used is as follows, then the error we get. Presume the calendar is held differently in vb3 - Any help appreciated.

require("includes/config.php");
$num_active = 20;
$num_chars = 75;

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$fp = fopen("news/events10.js", "w");
@flock($fp, 2);
$today = date("Y-m-d",time());
print ("$today<br>");
$querylatest="SELECT event, DATE_FORMAT(eventdate,'%a %d %b') AS date,
eventdate, eventid, subject
FROM calendar_events WHERE (public = 1 AND eventdate>='$today') ORDER BY eventdate LIMIT $num_active";
echo $querylatest;
$resultlatest = mysql_query($querylatest,$db);
while ($event = mysql_fetch_array($resultlatest)) {
$eventid = $event[eventid];
$eventtitle = addslashes($event[subject]);
$eventdate = $event[date];

print ("<b>$eventid $eventtitle $eventdate</b><br>");
fputs($fp, "document.write(\"<a href='http://www.southportforums.com/forums/calendar.php?action=getinfo&eventid=$eventid'>$eve nttitle</a> $eventdate<br>\");\n");
}
@fclose($fp);
print ("<br><b><u>Events Have been updated - Thank You</u></b><br><br>");

Causes error....
2004-09-04
SELECT event, DATE_FORMAT(eventdate,'%a %d %b') AS date, eventdate, eventid, subject FROM calendar_events WHERE (public = 1 AND eventdate>='2004-09-04') ORDER BY eventdate LIMIT 20
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
Reply With Quote
  #7  
Old 02-26-2005, 05:24 PM
smdani smdani is offline
 
Join Date: Nov 2004
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Incredible Clegg!! Thaks a lot for share your code.
May I made you a question?
How do you do to show last posts at your main page? I made a script that obtains last posts and prints out the texts, but it shows unparsed texts withs BBCODE TAGS and so...
May you help me?
Thanks in advance
Reply With Quote
Reply

Thread Tools
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


All times are GMT. The time now is 03:31 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04940 seconds
  • Memory Usage 2,243KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete