vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Show Events on non-vb page (https://vborg.vbsupport.ru/showthread.php?t=24939)

Dave# 08-09-2001 08:26 AM

I will pay anyone who can modify the following hack

http://vbulletin.com/forum/showthrea...threadid=21232

to do the following
  • Run as a standalone script for inclusion in a non VB page
  • Be able to pull the next 5 events from the callendar (not just todays events) from todays date (including todays events)

Payment is open to negotiation but this is an urgent requirement.

Payment will be via one of the following options depending on how you want paid
  • paypal
  • cheque
  • bank transfer

Please PM me asap to get this work.

Please state:

a) The cost
b) the timescales

Thanks

Dave Campbell www.cpfc.org

sysmom 08-09-2001 02:03 PM

I'll bet Dave has a bigger budget than I do, but I'm pretty interested in this, as well.

Not neccesarily just the next 5 events, but the listings over the next X number of days would be good, too.

-deb

boatdesign 08-11-2001 01:41 PM

Me too!

Would love a mod which would show the next x events or events for the next x days on my homepage...

Freddie Bingham 08-11-2001 06:58 PM

PHP Code:

<?php

include('./global.php');
  
$events $DB_site->query("SELECT event, eventdate, eventid, subject
                           FROM calendar_events
                           WHERE public = 1 AND eventdate >= '"
.vbdate('Y-m-d',time())."'
                           ORDER BY eventdate LIMIT 5"
);
if (
$DB_site->num_rows($events)) {
  echo 
"Next Five Events:<br>";
  while (
$event $DB_site->fetch_array($events)) {
    echo 
"<a href='calendar.php?s=$session[sessionhash]&action=getinfo&eventid=".$event['eventid']."'>".$event['subject']."</a><br>";
  }
} else {
  echo 
"No Events";
}
?>

It should even be Kier approved in terms of quoted array indices but it may be subject to correction.

Dave# 08-11-2001 07:18 PM

Quote:

Originally posted by freddie
PHP Code:

<?php

include('./global.php');
  
$events $DB_site->query("SELECT event, eventdate, eventid, subject
                           FROM calendar_events
                           WHERE public = 1 AND eventdate >= NOW()
                           ORDER BY eventdate LIMIT 5"
);
if (
$DB_site->num_rows($events)) {
  echo 
"Next Five Events:<br>";
  while (
$event $DB_site->fetch_array($events)) {
    echo 
"<a href='calendar.php?s=".$session['sessionhash']."&action=getinfo&eventid=".$event['eventid']."'>".$event['subject']."</a><br>";
  }
} else {
  echo 
"No Events";
}
?>

It should even be Kier approved in terms of quoted array indices but it may be subject to correction.

You really can't imagine how happy this makes me :)

People can spout off about other products 'community' and 'support' but VB is in a different class.

I'll leave it there b4 I start gushing :)

Freddie Bingham 08-11-2001 07:34 PM

It just shows you how do it, you will have to format it how you wish. If you are not going to use the event text than you can remove it from the SELECT portion of the query.

Dave# 08-11-2001 07:39 PM

Quote:

Originally posted by freddie
It just shows you how do it, you will have to format it how you wish. If you are not going to use the event text than you can remove it from the SELECT portion of the query.
The formatting was a breeze as log as I escape " :)

It;s exactly as I needed 100% perfect and will save me lots of time every week

In action www.cpfc.org (latest fixtures)

Mike Sullivan 08-11-2001 07:44 PM

[QUOTE]Originally posted by Dave#
In action www.cpfc.org (latest fixtures)

Dave# 08-11-2001 07:46 PM

Quote:

Originally posted by Ed Sullivan
It's linking to the wrong place though :)

http://www.cpfc.org/calendar.php?act...nfo&eventid=82 gives a 404.

Should be: http://www.cpfc.org/forums/calendar....nfo&eventid=82

And make sure that's not a hardcoded sessionhash -- I don't know if you're including vB elements, which would generate a new sessionhash or what.

Fixed that :)

Ed Can you explain the session hash thing please? Should the href be different than calendar.php?s=$session[sessionhash] ?

sysmom 08-11-2001 08:05 PM

Wow, this can go on a non-vBulletin page, too?

-deb

Mike Sullivan 08-12-2001 01:36 AM

[QUOTE]Originally posted by Dave#
Ed Can you explain the session hash thing please? Should the href be different than calendar.php?s=$session[sessionhash] ?

boatdesign 08-12-2001 12:47 PM

Very cool! Thank you, thank you!

One question,

I want to include the event date on my homepage, but when I use $event['eventdate'] I get the date in the format 2001-08-24. How would I either:

1.) Change it from 2001-08-24 to 08-24-2001 or

2.) What I really want to do is to not show the year on my homepage, displaying just 08-24 for the event instead of 2001-08-24.

Thanks again!

Freddie Bingham 08-12-2001 01:36 PM

Use this query:
Code:

SELECT DATE_FORMAT(eventdate,'%m-%d') AS eventdate, eventid, subject
                          FROM calendar_events
                          WHERE public = 1 AND eventdate >= NOW()
                          ORDER BY eventdate LIMIT 5


boatdesign 08-12-2001 02:41 PM

Thanks again.

Now it's in the format I want (just Month-date wihtout a year to shorten it) but this messes up the sorting.

I have one event entered in Feb 2002, and if I leave off the year according to your instructions it is now showing up at the top of the list (2-06 (of 2002) is now coming before 8-15)

Any ideas on how to fix the sorting and still leave off the year from the displayed list?

For that matter, would it be possible to use some kind of array (?) to convert 01 to Jan, 02 to Feb, 03 to Mar, etc... so the date would display as Aug 15 for example?

Thanks again for the original mod which is already fantastic!

Freddie Bingham 08-12-2001 03:09 PM

PHP Code:

<?php

include('./global.php');
  
$events $DB_site->query("SELECT DATE_FORMAT(eventdate,'%b %d') AS date, eventid, subject
                           FROM calendar_events
                           WHERE public = 1 AND eventdate >= '"
.vbdate('Y-m-d',time())."'
                           ORDER BY eventdate LIMIT 5"
);
if (
$DB_site->num_rows($events)) {
  echo 
"Next Five Events:<br>";
  while (
$event $DB_site->fetch_array($events)) {
    echo 
"<a href='calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]'>$event[subject]</a><br>";
  }
} else {
  echo 
"No Events";
}
?>

Refer to $event[date] for the date output in your template.

dkilburn 08-12-2001 03:21 PM

This is a great hack :-) OK, not to sound dumb, but where exactly do I use this? I am new to PHP so this is a great learning experience!

Do I add the code above to the todaysevents.php file? I'd like to place the events on the top of my VB as a reminder of deadlines for my students. My class homepage (http://www.collegeteacher.org) is set up with SSI. Can I call the script through SSI to include on the homepage as well? I know that converting the whole site to PHP is probably the right answer, but that will have to wait till next semester. School starts tomorrow!

Thanks for your help :D

boatdesign 08-12-2001 03:45 PM

What I did was to create a new php file called showevents.php with just the code above.

Then on my SSI pages, I include an include statement like:
<!--#include virtual="/forums/showevents.php"-->

And it works like a charm!

xdam 08-13-2001 05:20 AM

how could i call calander events for a specific user?

boatdesign 08-13-2001 07:40 PM

An interesting side effect I just noticed is that a visitor to any of the pages on which you've included the list of upcoming events now shows up in the online.php section and counts as a visitor on the forum homepage...

xdam 08-14-2001 08:42 AM

please please please help me with my question ive been asking it for days

JackG 08-18-2001 08:46 PM

Oooooooh YEAH It works..displays the events
fim but on top of the 5 events listings I get this error:

Warning: Failed opening './global.php' for inclusion (include_path='') in D:\websites\clubFREESTYLE.com\test.php on line 138


you can see for youself on our test page:

http://www.clubfreestyle.com/test.php

(left side column)

-----------------------
If i change the code to reflect: forum/admin

I get this error:

Warning: Failed opening '/forum/global.php' for inclusion (include_path='') in D:\websites\clubFREESTYLE.com\test.php on line 137



Thanks

JackG 08-18-2001 09:00 PM

UPDATE:

I removed the : include('./global.php');
call and it works fine with no error

Is this ok to do?

Pyro 08-28-2001 03:14 PM

Hi everyone,

this hacks just works fine - if, yes if the php file which includes the calendar_hack.php3 is in the vb directory.

I would like to include the hack code like this
PHP Code:

<? include ("calendar_hack.php3"); ?>

in my index_homepage.php3 file which is NOT in the vb directory.

When I do this from outside that dir, it always give me a
Quote:

Failed opening required './global.php3' (include_path='')...
When I use the absolute path to global.php3 in the calendar_hack.php3 file, it does not find the config.php3...

So, how do I have to include correctly (best would be in absolute paths) that it works for pages from outside the vb directory???

Many thanks in advance!
Markus

Pyro 08-29-2001 01:51 PM

Ok thanks,

chdir('directory');

before the inclusion is the correct way...

Markus

atease 02-06-2002 10:44 AM

Quote:

Originally posted by freddie
PHP Code:

<?php

include('./global.php');
  
$events $DB_site->query("SELECT event, eventdate, eventid, subject
                           FROM calendar_events
                           WHERE public = 1 AND eventdate >= '"
.vbdate('Y-m-d',time())."'
                           ORDER BY eventdate LIMIT 5"
);
if (
$DB_site->num_rows($events)) {
  echo 
"Next Five Events:<br>";
  while (
$event $DB_site->fetch_array($events)) {
    echo 
"<a href='calendar.php?s=$session[sessionhash]&action=getinfo&eventid=".$event['eventid']."'>".$event['subject']."</a><br>";
  }
} else {
  echo 
"No Events";
}
?>

It should even be Kier approved in terms of quoted array indices but it may be subject to correction.


tried this but get this error: Fatal error: Failed opening required './admin/config.php' (include_path='.:/usr/local/lib/php') in /home/atease/public_html/forums/global.php on line 72

does anyone know what i might have done wrong?
i'd appreciate it.
thanks

sysmom 03-13-2002 06:10 AM

Well, I have a completely new (but spectacular) issue with this great little scrap of code that calls out the next 5 events.

First, it works, :)

However, I'm changing things over to a PostNuke front page and content pages for a site, with VB as the workhorse forum and community.

I need the little events script to run in a standard php block for PostNuke. The PostNuke is in a separate mySQL database from the vBulletin.

Now, I did get it to run. BUT, it seems to *clobber* the living daylights out of a couple (but not all) other modules that are used with PostNuke.

So the page loads, the events are listed, but the moment you try to go to one of the affected modules, it starts spitting out:

Warning: Supplied argument is not a valid MySQL result resource

and goes on to give the path of the php file, which I won't bore you with here. There's a few warnings like this. It's really quite spectacular all over the screen. ;)

First, let me say I know enough about php and mySQL to be dangerous. But I follow directions very well!

I have a suspicion that after the events query is made, the rest of the page gets confused about what database it is in. But why this only happens with some modules and not others is a mystery to me.

I might be all wrong.

Whatever is happening, it isn't pretty, and I'd really like to be able to include the events on the front page.

I don't know how to fix it, whether it is what I think it is or not, though. :|

Would someone please explain to me what could be going on, and how to fix it? I can point you to specific files and examples if needed, but I'll bet you vBulletin and php gurus would know what to do in your sleep with your hands tied and your computer off! It seems like some sort of obvious error condition like that to me. :(

Halp Mr. Wizard!

-deb

Broncos 03-16-2002 06:17 PM

I can get this to work fine if I call the events.php file itself. But when I try to include that file on my front page I get the following:

Warning: Failed opening './global.php' for inclusion (include_path='') in /path/to/my/board/events.php on line 3

Fatal error: Call to a member function on a non-object in /path/to/my/board/events.php on line 5

I tried putting the assolute path in line 3:

include('/path/to/my/board/global.php');

but that simply produces a blank screen?

WebMasterAJ 03-17-2002 11:02 PM

I just found this, and it is EXACTLY what I'm looking for. When I originally installed the hack, I had less than 5 next events. I then added a lot more dates (about 15 more).

Now, I receive this error:

Warning: Cannot add header information - headers already sent by (output started at /path/username/to/boards/calendarfront.php:3) in /path/username/to/boards/admin/functions.php on line 1581

I named this PHP script calendarfront.php

Thanks for any help!

WebMasterAJ 03-18-2002 01:19 PM

I did some more trouble shooting with this and found that when I went DIRECTLY to the page that loads the script I get that error. However, if I first go to my message boards, and then go to the page, it works fine.

EX: Go to http://www.finheaven.com/, then http://www.finheaven.com/seasonal/dates.shtml in a new browser window after all other windows are closed

Someone I talked to said that it sounds like a cookie issue, but that's just a guess - i.e. expecting a cookie to exist that does not

However, if you go to the message boards: http://boards.finheaven.com/ and then type the URL in the Address bar it works fine. Strange....

Any ideas?

WebMasterAJ 03-18-2002 03:08 PM

I found out why the problem was being caused. Thank you for your time.

Daderin 03-18-2002 06:28 PM

Could you let us know how you solved that problem Webmasta please ? I remember getting the same errors when I was trying something and I gave up after it

Clegg 08-21-2003 05:13 AM

I am not a programmer or anything cool like that. I am a geek who just knew how to read a SQL DB and get this thing working under vB3

So here is the code: (EDIT - Corrected a major error in the code date setup due to vb3)

PHP Code:

$events $DB_site->query ("SELECT UNIX_TIMESTAMP() AS dateline, dateline_from, eventid, title 
                           FROM event
                           WHERE calendarid = 1 AND dateline_from > dateline
                           ORDER BY dateline_from LIMIT 4"
); 

dateline_from is the vb3 variable for the starting date of the event, and am defining the field dateline for the current date and getting a unix timestamp to so the comparison in the where is more reliable ( had some issue with YYYY-DD-MM formats). Then later with a string like this:
PHP Code:

$timestring=$event['dateline_from']; 
$dateevent=date("M j,Y",$timestring); 

I convert the dateline_from into a readable format.


works like a freaking charm :)

roxics 09-25-2003 08:20 AM

Is there anyway to get this to show up easily on any VB (really a webtemplates) page via an $events tag or something?

Thanks

offlead 01-15-2004 05:49 PM

Okay, does anyone have the full code for this for vb3, that they could share? I've managed to get, well, something, pulling into the non-forum page, and I have it linking to the calendar, but I'm only getting one event, and the link isn't quite correct (it links to the calendar okay, but not to the event). I'm all confused. :)

filmhobbit 01-29-2004 02:16 AM

Right so this doesn't work even a little or is just to complex for me to understand. Probably both.

filmhobbit 01-29-2004 02:37 AM

ah there it goes! kicked in with some tinkering. Nice little script guys! Good work.

krit 01-29-2004 02:43 AM

Hi guys.

I too would love someone to simply post the php coding they are using for vB3. I presume most are creating a file, say eventlist.php, and calling it into their page via include statements? If someone could post the code in the php file that would be appreciated greatly!

Cheers
Krit

offlead 02-05-2004 06:18 AM

I actually managed to get this working, eventually, but just discovered that it's showing old events that are already past. Eep! I've checked over the code, and it looks like it should be working correctly, but I'm definitely getting old events.

I checked the sql query in phpmyadmin, and I get the same results. The query is:
Code:

SELECT UNIX_TIMESTAMP( ) AS dateline, dateline_from, eventid, title
FROM event
WHERE calendarid = 1 AND dateline_from > dateline
ORDER BY dateline_from
LIMIT 5

and in phpmyadmin when I run this I get the same events as I do in the script. Here are the dateline and dateline_from values from the five events returned:

Code:

dateline                dateline_from            eventid            title
1075968522        1074603600            1                        Hernando Beach Blast III
1075968522        1074704400            3                        HBBIII 2004
1075968522        1077840000            11                      Hinkster's Birthday
1075968522        1082246400            12                      Michigan NCRS Swap Meet
1075968522        1083283200          7                New England Chapter Event

I can see that the dateline value being returned appears correct...it's the same for each row returned. But event 1 and event 3 were in January, and clearly their dateline_from values are less than the dateline values. So why are they being returned?

*confused* :)

offlead 02-23-2004 04:43 AM

I still need some help with this. :) I managed to finally get it posting only upcoming events, and not events which have already past. However, now I'm getting the wrong dates displaying on the events. If an event is in the calendar for Feb 30, it displays on the non-vb page as being on Feb 29. All events are dated one day early.

Here's what I currently have.

PHP Code:

 <?php
 chdir
("/home/vettehea/public_html/forums");
 
 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( )
                                                         ORDER BY dateline_from
                                                         LIMIT 10"
); 
 
$vh_upcomingevents "";
 if (
$DB_site->num_rows($events)) {
     while (
$event $DB_site->fetch_array($events)) {
         
$timestring=$event['dateline_from'];
         
$dateevent=date("M j, Y",$timestring);
         
$vh_upcomingevents .= "$dateevent: <a href=\"/forums/calendar.php?$session[sessionurl]do=getinfo&amp;day=$day&amp;e=$event[eventid]&amp;c=$event[calendarid]\">$event[title]</a><br />";
     }
 } else {
     
$vh_upcomingevents .=  " -- no events currently listed -- ";
 }
 
 
?>

I'd greatly appreciate any help clearing up this last issue to this for me.

:)

offlead 02-25-2004 03:12 PM

Quote:

Originally Posted by offlead
I still need some help with this. :) I managed to finally get it posting only upcoming events, and not events which have already past. However, now I'm getting the wrong dates displaying on the events. If an event is in the calendar for Feb 30, it displays on the non-vb page as being on Feb 29. All events are dated one day early.

Here's what I currently have.

PHP Code:

 <?php
 chdir
("/home/vettehea/public_html/forums");
 
 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( )
                                                         ORDER BY dateline_from
                                                         LIMIT 10"
); 
 
$vh_upcomingevents "";
 if (
$DB_site->num_rows($events)) {
     while (
$event $DB_site->fetch_array($events)) {
         
$timestring=$event['dateline_from'];
         
$dateevent=date("M j, Y",$timestring);
         
$vh_upcomingevents .= "$dateevent: <a href=\"/forums/calendar.php?$session[sessionurl]do=getinfo&amp;day=$day&amp;e=$event[eventid]&amp;c=$event[calendarid]\">$event[title]</a><br />";
     }
 } else {
     
$vh_upcomingevents .=  " -- no events currently listed -- ";
 }
 
 
?>

I'd greatly appreciate any help clearing up this last issue to this for me.

:)

*bump*

Anyone? :)


All times are GMT. The time now is 04:44 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.01428 seconds
  • Memory Usage 1,909KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (9)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete