The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Show Calendar entries on homepage
Is anyone still looking for this hack or did someone already post a way to extract events from a calendar based on how close that date is to today?
I have a solution but would like to see if there is any interest by the forum members. thanks! |
#2
|
|||
|
|||
i would be interested!
|
#3
|
|||
|
|||
Well for everyone's benefit heres my hack to extract the next events from the calendar if they fall 10 days before today and 10 days after today.
The way you work with this script is that you put it in your crontab and if you can't put it in your crontab then you can include it in your homepage. Putting it in your crontab is more effective because really you only want to run this script to run only once a day. In your crontab ( crontab -e ) type 0 6 * * * php -q /location/of/your/script > /the/path/to/your/website/calendaritems.php This will create a .php on your website and you can then edit your index.php to call the php by adding <? require("calendaritems.php"); ?> If you can't put the script in crontab then you could alternatively just put in a file called "calendaritemsscript.php" and then doing a <? require("calendaritemsscript.php"); ?> The downside of that is that your website will be hammering the database and pulling the info everytime a visitor comes to open your website. I highly recommend against doing it this way. Here is the script: <? $connecttodb=mysql_connect("localhost","username", "password" ) or die ("Unable to connect to MySQL"); $calendarentries = "select eventid,title,DATE(FROM_UNIXTIME(dateline_from)),D ATE(FROM_UNIXTIME(dateline_to) ) from event where date_sub(now(),INTERVAL 10 DAY) <= FROM_UNIXTIME(dateline_from) and date_add(now(), INTERVAL 10 DAY) >= FROM_UNIXTIME(dateline_to)"; $db = mysql_db_query("forumdatabase", $calendarentries); $numrows = mysql_num_rows($db); echo " <table width='260'> <tr> <td bgcolor=\"#15589B\" align='center'><b><font size='2' color='white'>Calendar of Events </font></b></td> </tr> <tr> <td>"; If ($db) { While ($pp = mysql_fetch_array($db)) { $id = $pp["eventid"]; $title = $pp["title"]; $from = $pp["DATE(FROM_UNIXTIME(dateline_from))"]; $to = $pp["DATE(FROM_UNIXTIME(dateline_to))"]; echo " <font size=1> <a href=\"http://www.yourforumwebsite.com/calendar.php?do=getinfo&day=$from&e=$id&c=1id\" target=_blank> $title </a> </font> <br>"; } } echo "</td> </tr> </table> "; ?> Any questions, ask away. |
#4
|
|||
|
|||
TY! i will be trying this out shortly
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|