PDA

View Full Version : Upcoming Events next X days (from index) on an external page: no luck so far


Dan Livo
01-13-2005, 11:59 AM
Modification Request
Display calendar events from the next x days on a non-vbulletin page.

Lack of Success So Far
I've been trying to create my own hack that shows a table of the upcoming events (as on the index page if that option is set) on an external page. I haven't been having much luck so far and am looking for some guidance.

What's already been done by others (at vb.org)
From looking through this site, I find that Sharg has enlisted Colin F to do this exact hack as a service request (paid hack) - see https://vborg.vbsupport.ru/showthread.php?t=69184 . There is also a very basic example of exporting the latest calendar entries at https://vborg.vbsupport.ru/showthread.php?t=64584 (which isn't what I want: I want those that occur in the next 14 days, including whatever recurring events fall in that period).

What I've unsuccessfully coded
I've been trying to work from the code in index.php to recreate this in another page but with only the calendar output as returned in the $upcomingevents variable. I ended up with the attached file - which requires several php files, as does the index.php page. I would have preferred to avoid emulating the index.php script but since my knowledge of php isn't that good I didn't/couldn't just start coding from scratch. I managed to get the desired result on my local machine (running an offline trial copy of my site) but when I uploaded it to http://www.waitaraweb.com/forum/upcomingevents.php I get the following error:


Unable to add cookies, header already sent.

File: /home/waitaraweb/domains/waitaraweb.com/public_html/forum/upcomingevents.php
Line: 4

I don't know enough php to get past this...

What are my Options?

If someone could code this for me that would be great!
Otherwise any pointers as to what I'm doing wrong would also be a great help...

Zachery
01-13-2005, 12:40 PM
Please, never ever again post a vBulletin file (that is found in the zip) on this website.
Thanks

Colin F
01-13-2005, 01:35 PM
Please, never ever again post a vBulletin file (that is found in the zip) on this website.
Thanks
Actually, don't post it anywhere.

Posting complete files is a violation of the license agreement and could get your license revoked.


Then again, I'm sure it was a mistake :) Just remember for next time ;)

Dan Livo
01-13-2005, 06:44 PM
Oopss - sorry - and thanks Zachary for removing the attached file. I didn't realise my licence number was in there - but can understand that was a bit foolish... As far as posting vbulletin copyrighted code, I'm happy to accept your judgment call on that one. I'm obviously a bit of a noob... and I had assumed that I had sufficiently reduced and hacked the file for rule 3.1 to apply. But now I see my assumption wasn't correct - my fault for just making the assumption...

Sorry I didn't get back till now - was 1am here when I posted.

Well... sorry again about my pretty poor introduction of myself to this site - and thanks for your understanding, Colin F. I hope there is someone who can help out there...

Dan Livo
01-13-2005, 09:26 PM
OK, I think I figured out at least a temporary fix for this. To eliminate the 'header already sent' error, I placed the call to global.php before any <html> code. So it's now working without giving that error...

However, I still feel this* is a fairly ugly way of coding this solution. E.g. When looking at "Who's online", there's an entry:
Unknown Location
/forum/upcomingevents.php
* Since I guess I shouldn't attach my code (since it is only a partial modification of the vb index.php file, I'll briefly explain what I did - as follows:
- With the index.php file I cut out all the main script except for that which compiles the upcoming events output. (I left the top section with calls to global.php etc...)
- I added in echo $upcomingevents (to directly output that rather than pass it through any other print_output function which would also add template info etc...)
- I added a few other cosmetic changes etc, but that was basically it.

Andreas
01-13-2005, 11:13 PM
You can fix the unknown location be placing


define('LOCATION_BYPASS', 1);


before calling global.php.

To make this totally independant from the vBulletin backend does require some work.

Dan Livo
01-14-2005, 12:44 AM
You can fix the unknown location be placing


define('LOCATION_BYPASS', 1);


before calling global.php.

To make this totally independant from the vBulletin backend does require some work.
Thanks - that seems to have fixed that little quirk... - I guess we'll have to wait and see what other quirks I might have to fix / put up with since it relies so heavily on the vB backend...

Cheers,

Dan Livo
01-17-2005, 05:24 AM
In response to a PM'd request I've attached a brief guide as to how I did my hack...

Note the above comments that I'd much prefer a solution that doesn't rely so heavily on the vB backend, so I'm certainly not recommending this for wider use. I hope it's of some use to someone... and perhaps any more experienced coders can give their feedback on how it could/should have been done! ;)