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)

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


All times are GMT. The time now is 06:17 AM.

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.01047 seconds
  • Memory Usage 1,739KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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