PDA

View Full Version : Show Events on non-vb page


Dave#
09 Aug 2001, 09:26
I will pay anyone who can modify the following hack

http://vbulletin.com/forum/showthread.php?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
09 Aug 2001, 15:03
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
11 Aug 2001, 14:41
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
11 Aug 2001, 19:58
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

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

Dave#
11 Aug 2001, 20:18
Originally posted by freddie


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

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
11 Aug 2001, 20:34
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#
11 Aug 2001, 20:39
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
11 Aug 2001, 20:44
Originally posted by Dave#
In action www.cpfc.org (latest fixtures) It's linking to the wrong place though :)

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

Should be: http://www.cpfc.org/forums/calendar.php?action=getinfo&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.

Dave#
11 Aug 2001, 20:46
Originally posted by Ed Sullivan
It's linking to the wrong place though :)

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

Should be: http://www.cpfc.org/forums/calendar.php?action=getinfo&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
11 Aug 2001, 21:05
Wow, this can go on a non-vBulletin page, too?

-deb

Mike Sullivan
12 Aug 2001, 02:36
Originally posted by Dave#
Ed Can you explain the session hash thing please? Should the href be different than calendar.php?s=$session[sessionhash] ? That's correct. I just wasn't sure if that you included the variable in the link or accidently hardcoded it when copying a link (I've done that before :)).

boatdesign
12 Aug 2001, 13:47
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
12 Aug 2001, 14:36
Use this query:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

boatdesign
12 Aug 2001, 15:41
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
12 Aug 2001, 16:09
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

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

dkilburn
12 Aug 2001, 16:21
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
12 Aug 2001, 16:45
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
13 Aug 2001, 06:20
how could i call calander events for a specific user?

boatdesign
13 Aug 2001, 20:40
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
14 Aug 2001, 09:42
please please please help me with my question ive been asking it for days

JackG
18 Aug 2001, 21:46
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
18 Aug 2001, 22:00
UPDATE:

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

Is this ok to do?

Pyro
28 Aug 2001, 16:14
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


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

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 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
29 Aug 2001, 14:51
Ok thanks,

chdir('directory');

before the inclusion is the correct way...

Markus

atease
06 Feb 2002, 11:44
Originally posted by freddie


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

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
13 Mar 2002, 07:10
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
16 Mar 2002, 19:17
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
18 Mar 2002, 00:02
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
18 Mar 2002, 14:19
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
18 Mar 2002, 16:08
I found out why the problem was being caused. Thank you for your time.

Daderin
18 Mar 2002, 19:28
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
21 Aug 2003, 06:13
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)



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


I convert the dateline_from into a readable format.


works like a freaking charm :)

roxics
25 Sep 2003, 09:20
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
15 Jan 2004, 18:49
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
29 Jan 2004, 03:16
Right so this doesn't work even a little or is just to complex for me to understand. Probably both.

filmhobbit
29 Jan 2004, 03:37
ah there it goes! kicked in with some tinkering. Nice little script guys! Good work.

krit
29 Jan 2004, 03:43
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
05 Feb 2004, 07:18
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:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


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
23 Feb 2004, 05:43
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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

:)

offlead
25 Feb 2004, 16:12
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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

:)
*bump*

Anyone? :)

gopherhockey
07 Mar 2004, 02:08
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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

:)

I used your code and it works for me, plus the dates are all just fine. It isn't picking up all the events, however.. don't know why some are just missing. Could it be a timezone issue with your server maybe? (just grasping for straws) - maybe you could compensate by adding or subtracting one day... ?

One thing I have a problem with is how far out its reaching. It gets the next X number of events, regardless of the dates. I'd like to only display X number of events X days ahead. Currently my test board has 2 events next week and one Oct. of this year and its showing that one.... thats a bit too far out to be reminding people I think ;)

magmaink
22 May 2004, 20:44
Anyone Get any updates on this.. V3 is 1 day off still??

magmaink
26 May 2004, 01:03
anyone?

magmaink
31 May 2004, 02:36
need this bad....somebody please respond!

magmaink
06 Jun 2004, 15:48
no love?

user 1-2-3
14 Jun 2004, 01:52
How can I make the same thing for 3.0.1? I need to place events from calendar into the home page.

magmaink
22 Jun 2004, 14:34
Alright dammit....I am completely clueless in regards to php but I still managed to figure this one out. on the timestring code......you have to add "+= 86400" in order to compensate for the missing 24 hours.....Here's my code:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

traderx
12 Nov 2004, 06:43
Alright dammit....I am completely clueless in regards to php but I still managed to figure this one out. on the timestring code......you have to add "+= 86400" in order to compensate for the missing 24 hours.....Here's my code:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Will the above work for 3.0.3? I am also looking for something to get the last X threads and polls.... any one?

Coll

Rebecca217
17 Nov 2004, 15:39
I'm using 3.0.3 also, and needed this same thing. The above code didn't work for me as-is, so I tweaked it a bit until I got what I needed. I don't claim to be a programmer, so use this at your own risk. ;)


Alter this to point to your own Vb installation, then paste it above everything else in your page. (Before the <html> tag, etc.)


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Paste this where you'd like the events to appear. Alter the $day format to your preferences. Also, the LIMIT variable can be changed to however many entries you'd like listed.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Hope this helps!

Rebecca

traderx
19 Nov 2004, 07:03
I will give that a try very soon.... Thanks

I went to your site (nice) and saw that you are pulling the lastest threads also, could you point me to the post about that or pm it to me pls

Thanks
Coll

majorxp
15 Sep 2005, 18:48
I got it to work for me using 3.5...


Here is the code I used. I hope this helps.


..disregard...I found a bug and I'm pulling this till I get it to work or I give up..sorry...


/...also sorry for bumping an old thread.../ :disappointed:



...edit...

the code works fine for non-repeating events. i have no clue how to get a list of upcomming events for the next week to include them.........

/sigh