Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Calendar events on non-VB pages Details »»
Calendar events on non-VB pages
Version: 1.00, by wbear wbear is offline
Developer Last Online: Oct 2013 Show Printable Version Email this Page

Version: 3.5.2 Rating:
Released: 01-12-2006 Last Update: Never Installs: 29
Is in Beta Stage  
No support by the author.

This extension allows you to pull calendar events to display on a non-VB page. You'll need to change the first few lines to reflect your current site information, and look within the code for the site URL to change to your own. In this script, it occurs three times (DOMAIN.COM/FORUM_ADDRESS).

Needs to be on a page that is parsed for PHP content, either by way of naming the page '.php', or by using .htaccess to add it to the list of files that are parsed by PHP. [AddType application/x-httpd-php .html]

I've seen lots of requests for this, but couldn't locate anyone that had released one, so here goes (mods, if there is one like this, feel free to remove mine..I couldn't find it). The code was gathered from a number of sources long ago and slapped together by me. I don't know the full origin of each bit, so if you wrote any of this and want credit, go for it. In it's current (unpolished) state, it's been heavily adapted by me anyway, and there's room for improvement, certainly. It's inelegant code (an understatement), but works AFAIK.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 06-02-2006, 08:45 AM
MamboCube's Avatar
MamboCube MamboCube is offline
 
Join Date: Jul 2005
Location: Cardiff, Wales
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

for my website i use this

Code:
<?php  
$host   = 'localhost'; 
$dbUser = 'db_user';   
$dbPass = 'password'; 
$db = 'db_name'; 
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT * FROM vb3_event order by dateline DESC LIMIT 10" ) or die(mysql_error());   
while($row = mysql_fetch_array( $result )) {	
print  "<a href='http://www.DOMAIN.COM/FORUM_ADDRESS/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=2'>". $row['title'] . "</a><br>" ;
}
?>
this grabs the last events from the database, it does not use global.php

i find this works just as well
Reply With Quote
  #53  
Old 06-06-2006, 05:34 AM
Zilvia's Avatar
Zilvia Zilvia is offline
 
Join Date: Apr 2002
Location: Denver, CO
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

MamboCube: This actually worked on my CMS site, but it dosent display correctly. Its not in order and it will display old and out of date events. Is there a way to add a date and then order it from latest to oldest and have it remove the old events? I played around with it a bit but couldnt get it to work right with my limited knowledge. Thanks
Reply With Quote
  #54  
Old 06-06-2006, 05:47 AM
MamboCube's Avatar
MamboCube MamboCube is offline
 
Join Date: Jul 2005
Location: Cardiff, Wales
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

have u put in this bit?:

Code:
order by dateline DESC LIMIT 10
because that should grab the last events and only show ten
Reply With Quote
  #55  
Old 06-06-2006, 07:22 PM
rabidkevin rabidkevin is offline
 
Join Date: Aug 2005
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want it to list it with the date, and not show events which have already passed, use this code

Code:
<?php  
$host   = 'localhost'; 
$dbUser = 'username';   
$dbPass = 'pass'; 
$db = 'database'; 
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT * FROM vb35_event where dateline_from >= UNIX_TIMESTAMP() order by dateline_from ASC LIMIT 10" ) or die(mysql_error());   
while($row = mysql_fetch_array( $result )) {	
$dateevent = date('M j, Y', $row[dateline_from]);
print  "$dateevent - <a href='http://WWW.DOMAIN.COM/FORUMS/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=1'>". $row['title'] . "</a><br>" ;
}
?>
Reply With Quote
  #56  
Old 06-07-2006, 01:22 AM
Zilvia's Avatar
Zilvia Zilvia is offline
 
Join Date: Apr 2002
Location: Denver, CO
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have tried both of those options.

dateline dosent display in the correct order nor does dateline_from or to or really any other filds I tried.
Reply With Quote
  #57  
Old 06-07-2006, 01:54 PM
rabidkevin rabidkevin is offline
 
Join Date: Aug 2005
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works for me... http://www.eternalbeats.net/home2.php
using the code i just pasted
Reply With Quote
  #58  
Old 06-09-2006, 03:44 AM
Zilvia's Avatar
Zilvia Zilvia is offline
 
Join Date: Apr 2002
Location: Denver, CO
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rabidkevin
works for me... http://www.eternalbeats.net/home2.php
using the code i just pasted
Oh man! I read over and swore it was identical to what I had tried and retried many time. This got it working for me! You ROCK!
Reply With Quote
  #59  
Old 06-09-2006, 05:13 AM
rabidkevin rabidkevin is offline
 
Join Date: Aug 2005
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no prob
if you wanna see it in action use http://www.eternalbeats.net/home.php now, i updated

also if someone could help with code to retrive the custom fields, that would be dope
Reply With Quote
  #60  
Old 01-13-2007, 10:28 AM
helden helden is offline
 
Join Date: Dec 2005
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Final workin Code also for 3.6

sorry for my poor english

PHP Code:
<?php  
$host   
'localhost'
$dbUser 'user';   
$dbPass 'wort'
$db 'db666'
mysql_connect("$host""$dbUser""$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result mysql_query("SELECT * FROM vb3_event where dateline_from >= UNIX_TIMESTAMP() order by dateline_from ASC LIMIT 10" ) or die(mysql_error());   
while(
$row mysql_fetch_array$result )) {    
$dateevent date('M j, Y'$row[dateline_from]);
print  
"$dateevent - <a href='http://www.deinehomepage.com/vbullitin/calendar.php?do=getinfo&e=" $row['eventid'] . "&c=1'>"$row['title'] . "</a><br>" ;
}
?>

LIMIT 10 say "show 10 dates" and is changebel
Reply With Quote
  #61  
Old 04-09-2007, 04:46 AM
NorthwoodsFella NorthwoodsFella is offline
 
Join Date: Apr 2007
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was looking for a way to display the calendar events from a specific calendar on certain sub-forums. I looked and looked and tried dozens of "working code" examples, but could NOT get anything to work properly.

I found the previous example code to be very close, but I kept having problems with the date, so I made a couple of modifications to get it to work the way I wanted.

The following example will display the Calendar ID 3 events if the Forum ID is 3. This is done with two modifcations. A modification to the forumdisplay.php code and a modification to the ForumDisplay Template. I also set the number of event days to 45 because I have it set to '0' in the vb options.

forumdisplay.php
PHP Code:
if ($vbulletin->GPC['forumid'] == )
{

if (
$vbulletin->GPC['forumid'] == ) {$calendarid ;}

$host   "your_localhost";  
$dbUser "your_dbuuser";    
$dbPass "your_dbpass";  
$mydb "your_db";  

mysql_connect("$host""$dbUser""$dbPass") or die(mysql_error()); 
mysql_select_db("$mydb") or die(mysql_error());

$u TIMENOW;

$vbulletin->options['showevents']=45;

$futuredate = ($vbulletin->options['showevents'] * 86400)+$u;

$result mysql_query("SELECT * FROM event where (dateline_from+172800) >= UNIX_TIMESTAMP() 
AND dateline_from+86400 < 
$futuredate 
AND calendarid = 
$calendarid 
order by dateline_from ASC LIMIT 10" 
) or die(mysql_error());    

while(
$row mysql_fetch_array$result )) {     
$dateevent date('m-d-Y', ($row[dateline_from]+86400)); 
$upcomingevents "$upcomingevents"<a 
href='http://www.yourwebsite.com/calendar.php?do=getinfo&e=
$row[eventid]&c=$calendarid'>$row[title]</a>: " "$dateevent."<br>";




I use the same events format as the one used for index.php and have inserted it into the forumdisplay template.


ForumDisplay Template
PHP Code:
<!-- upcoming events -->
<if 
condition="$vbulletin->GPC['forumid'] == 3">

<
table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<
tbody>
    <
tr>
        <
td class="thead" colspan="2">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('forumhome_events')"><img id="collapseimg_forumhome_events" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_events].gif" alt="" border="0" /></a>
            <if 
condition="$show['todaysevents']">$vbphrase[todays_events]<else /><phrase 1="$vboptions[showevents]">$vbphrase[upcoming_events_for_the_next_x_days]</phrase></if>
        </
td>
    </
tr>
</
tbody>
<
tbody id="collapseobj_forumhome_events" style="$vbcollapse[collapseobj_forumhome_events]">
    <
tr>
        <
td class="alt2"><a href="calendar.php$session[sessionurl_q]"><img src="$stylevar[imgdir_misc]/calendar.gif" alt="$vbphrase[calendar]border="0" /></a></td>
        <
td class="alt1" width="100%"><div class="smallfont">$upcomingevents</div></td>
    </
tr>
</
tbody>
</
table>
<
br>
</if>
<!-- / 
upcoming events --> 

This modification was installed on a board using 3.6.5.
Reply With Quote
Reply


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 11:22 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.08901 seconds
  • Memory Usage 2,350KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete