Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 27, 2012, 02:36:55 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
155555
Posts in
21715
Topics by
7737
Members
Latest Member:
gx-world
WebsiteBaker Community Forum
English
Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
(Moderator:
Argos
)
display todays events from event-calender on frontpage
Pages: [
1
]
2
Go Down
Author
Topic: display todays events from event-calender on frontpage (Read 8263 times)
Olli
Offline
Posts: 290
display todays events from event-calender on frontpage
«
on:
June 09, 2007, 12:24:04 PM »
hello everybody,
this morning i tried to get a code snippet (based on the "display-news-anywhere-snippet") working to display todays events from the eventcalender module on the frontpage...
unfortunately i did not succeed
has anyone of you ever adapted this snippet to the eventcalender and might help me out?
maybe it's the weathers fault... it's too hot to concentrate on this for proper results
bye
Logged
kweitzel
Forum administrator
Offline
Posts: 6977
Re: display todays events from event-calender on frontpage
«
Reply #1 on:
June 09, 2007, 03:09:31 PM »
Why don't you post your code and we can see what is going wrong ...
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
Olli
Offline
Posts: 290
Re: display todays events from event-calender on frontpage
«
Reply #2 on:
June 09, 2007, 07:09:02 PM »
hi klaus,
i deleted it because of the time i wasted. and it wasn't working so nothing is lost...
but i will start over and post it here then. hopefully it will work then at once.
bye
Logged
kweitzel
Forum administrator
Offline
Posts: 6977
Re: display todays events from event-calender on frontpage
«
Reply #3 on:
June 09, 2007, 07:22:34 PM »
OK ... have a close look at the database tables where you pull the data from ... I think, that is the main difference to the news script.
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
Olli
Offline
Posts: 290
Re: display todays events from event-calender on frontpage
«
Reply #4 on:
June 09, 2007, 08:31:12 PM »
yeah ok i will, thanks dude
bye
Logged
doc
Guest
Re: display todays events from event-calender on frontpage
«
Reply #5 on:
June 10, 2007, 05:25:14 PM »
Hello,
you need to add one more query statement to the
display news anywhere snippet
to achieve what you want. Replace the code lines in the
include.php
file with the code posted below (without <?php and ?>).
Code:
<?php
// query to obtain news items for the selected group
$post_intervall
=
time
() - (
1
*
24
*
3600
);
// allow post from now - 1 day * 24h * 60m * 60s
if (
$group_id
<
1
) {
$query
=
"SELECT * FROM "
.
TABLE_PREFIX
.
"mod_news_posts WHERE active=1 AND (posted_when >
$post_intervall
) ORDER BY position DESC LIMIT 0,
$max_news_items
;"
;
} else {
$query
=
"SELECT * FROM "
.
TABLE_PREFIX
.
"mod_news_posts WHERE group_id=
$group_id
AND active=1 AND (posted_when >
$post_intervall
) ORDER BY position DESC LIMIT 0,
$max_news_items
;"
;
}
?>
Regards Christian
Logged
kweitzel
Forum administrator
Offline
Posts: 6977
Re: display todays events from event-calender on frontpage
«
Reply #6 on:
June 10, 2007, 06:41:40 PM »
Hi Christian,
I think ou misunderstood ... (or did I?) He wants to pull the Data from the Eventcalendar and not "today's latest posts" from the newsmodule ...
But like said, I might be wrong!?!?
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
doc
Guest
Re: display todays events from event-calender on frontpage
«
Reply #7 on:
June 10, 2007, 06:48:55 PM »
Hello Klaus,
seems you are right. However, maybe this kind of information is usefull for others too
In general a similar statement is requirement in the calendar script as well to achieve this.
Regards Christian
Logged
Olli
Offline
Posts: 290
Re: display todays events from event-calender on frontpage
«
Reply #8 on:
June 10, 2007, 07:02:03 PM »
hey guys,
yes i want to display todays events from the eventcalender anywhere else using a code section.
here is what i did. i adapted some code provided by pc-wacht (THANKS DUDE) some months ago.
to make it look better i put everything inside an upscrolling div-container. just delete the two leading <div>-tags from the code-area if you don't like it.
1.put this into your <head>....</head> area for the upscroll:
Code:
<script type="text/javascript">
var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''
function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}
function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}
if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee
</script>
2.this is for your css-file (only needed if you want to use the upscrolling effect)
Code:
#marqueecontainer{
text-align: left;
height: 180px;
width: 150px;
position: relative;
background-color: #E94747;
/* d31515 */
overflow: hidden;
border: 1px solid Maroon;
padding: 2px;
}
3. this is for the code-area
Code:
echo "Heutiger Auszug aus dem Veranstaltungskalender<br>";
echo "<div id=\"marqueecontainer\" onMouseover=\"copyspeed=pausespeed\" onMouseout=\"copyspeed=marqueespeed\"><div id=\"vmarquee\" style=\"position: relative; width: 98%;\">";
$datum = date("Y-m-d");
$get_page = 2; // change to your page_id you need
global $database;
$query = "SELECT * FROM `".TABLE_PREFIX."mod_event_dates` WHERE page_id = '$get_page' && date = '$datum' ORDER BY date DESC LIMIT 0, 5;";
$error = mysql_error();
if (!$result = mysql_query($query)) {
print "$error";
exit;
}
while($data = mysql_fetch_object($result)){
$eventsgefunden=1;
$page_id = $data->page_id;
$date = $data->date;
$event_longdesc = $data->event_longdesc;
$event_desc = $data->event_desc;
echo "<u>".$date."</u><br>".$event_desc;
echo "<div align=\"right\">".$event_longdesc."</div><br><br><br>";
}
if(!isset($eventsgefunden)) {
echo "Heute finden leider keine Veranstaltungen statt";
}
echo "</div></div><div style=\"font-size:9px;\">Maus zum stoppen über Text bewegen</div><br>";
sorry for mixing german and english here and there.
only events from present date are displayed. otherwise a general message gets printed on the screen.
this is very basic and copy&pasted in a hurry but at least it works
maybe this is useful for some of you...
have a nice sunday evening.
olli
«
Last Edit: June 15, 2007, 06:51:34 PM by Olli
»
Logged
doc
Guest
Re: display todays events from event-calender on frontpage
«
Reply #9 on:
June 10, 2007, 07:17:07 PM »
Hi Olli,
thanks for sharing that piece of code.
Regards Christian
Logged
Olli
Offline
Posts: 290
Re: display todays events from event-calender on frontpage
«
Reply #10 on:
June 10, 2007, 07:28:50 PM »
no problem
feels good to give something back to the community. but the main work was done by PC-WACHT
i forgot one thing: make sure to include the code inside the <head>....</head> area for the upscroll only on pages where needed! otherwise your page will not be valid anymore and contains errors.
just put this before the javascript and put the correct page id there:
Code:
<head>
....
<?php $page_id
=
PAGE_ID
; if (
$page_id
==
3
) {
?>
<script ...
....
</script>
<? } ?>
</head>
bye
«
Last Edit: June 10, 2007, 07:30:24 PM by Olli
»
Logged
jschor
Offline
Posts: 110
Re: display todays events from event-calender on frontpage
«
Reply #11 on:
June 11, 2007, 09:49:59 AM »
When this is finished can it be placed in the addons section as an "anyevent"-snippet??
Logged
Olli
Offline
Posts: 290
Re: display todays events from event-calender on frontpage
«
Reply #12 on:
June 11, 2007, 11:54:51 AM »
from my point of view this is finished. if anything is wrong or missing please let me know!
maybe i could do a module/installable addon of this which refers to an eventcaldender installation, but i'm not sure how to handle the code between the <head>...</head>-tags inside a module yet, because this must be placed inside the template index.php file...
Logged
doc
Guest
Re: display todays events from event-calender on frontpage
«
Reply #13 on:
June 11, 2007, 12:55:54 PM »
@Olli:
We have implemented a new function to WB v2.6.6 which allows to load external Javascript and CSS files for modules into the <head> section of the template. Once v2.6.6 is released, this should no longer be the show stopper
So start to create a installable module, I can help you with the integration of the JS code into the head section.
Regards Christian
Logged
Olli
Offline
Posts: 290
Re: display todays events from event-calender on frontpage
«
Reply #14 on:
June 14, 2007, 10:05:05 PM »
hey doc,
that's a very nice feature for WB to be able to control the <head> tag completly!
i will start to port this to a module the next days and will get back to you.
bye
Logged
spawnferkel
Offline
Posts: 96
Re: display todays events from event-calender on frontpage
«
Reply #15 on:
June 14, 2007, 11:39:17 PM »
Hi bakers,
I show my next five events from any event calender on my website with these code snipped in my template.
$termine = array();
$query = "SELECT event_desc, DATE_FORMAT(date,'%d.%m.%y') as date_formated FROM ".TABLE_PREFIX."mod_event_dates WHERE date >= NOW() AND event_desc NOT LIKE '' ORDER BY date LIMIT 0, 5";
$result = mysql_query($query);
if(!empty($result)){
while($data = mysql_fetch_assoc($result)){
$termine[] = $data;
}
if(!empty($termine)){
?><div id="termine">
<fieldset>
<legend>Termine...</legend><br />
<? foreach($termine as $termin){ ?>
<div style="border-bottom:1px solid #cccccc;"><strong>Am <?=$termin['date_formated']?></strong>
<p><?=$termin['event_desc']?></p>
</div>
<? } ?>
</fieldset>
</div><?
}
}
If you want to have a look to my solution you can find it in
www.malteser-hagen-atw.de
. The events are displayed on the left site under the login-form.
Logged
aggiedad
Offline
Posts: 57
Re: display todays events from event-calender on frontpage
«
Reply #16 on:
June 15, 2007, 02:22:26 PM »
Spawnferkel,
This is great & I would like to put it on my site for my students' assignments. My question is: What field do I use to also show the event description?
Many thanks!
Don Simmons
Logged
DGEC
Offline
Posts: 386
Re: display todays events from event-calender on frontpage
«
Reply #17 on:
June 15, 2007, 03:28:38 PM »
This is great! I did this for my pre-WB calendar and was wondering when I was going to have the time to dive in and do this for WB
Oh - wait - does it matter which calendar is this for? Do they all use the same database? I'm using EventCalendar by Keijo Karvonen v1.1.1
I really don't like the look of the other two, and I've modified Keijo's a bit as well.
Logged
Panther
Offline
Posts: 168
Re: display todays events from event-calender on frontpage
«
Reply #18 on:
June 15, 2007, 03:33:33 PM »
@aggiedad
I haven't tested this, but looking at the database tables, this should work...
Code:
$termine = array();
$query = "SELECT event_desc, event_longdesc, DATE_FORMAT(date,'%d.%m.%y') as date_formated FROM ".TABLE_PREFIX."mod_event_dates WHERE date >= NOW() AND event_desc NOT LIKE '' ORDER BY date LIMIT 0, 5";
$result = mysql_query($query);
if(!empty($result)){
while($data = mysql_fetch_assoc($result)){
$termine[] = $data;
}
if(!empty($termine)){
?><div id="termine">
<fieldset>
<legend>Termine...</legend><br />
<? foreach($termine as $termin){ ?>
<div style="border-bottom:1px solid #cccccc;"><strong>Am <?=$termin['date_formated']?></strong>
<p><?=$termin['event_desc']?></p>
<p><?=$termin['event_longdesc']?></p>
</div>
<? } ?>
</fieldset>
</div><?
}
}
I modified this to use a different calendar and you can play with the formatting by editing the <p> tags and such surrounding the parts where it does the output. Also, you can change the format of the date in this piece DATE_FORMAT(date,'%d.%m.%y')
If you are unsure on how to formate it for the way you want, just do a google of php date format for what the different formatting variables are.
I hard-coded a link to my page with the actual event calendar on it...
I think I can figure how to find what the $page_id is of the page that has the event calendar, but is there a way to create a link to a page with it's url? That way a link could be added after the list, that would bring you right to the calendar...
«
Last Edit: June 15, 2007, 03:42:44 PM by Panther
»
Logged
Panther
Offline
Posts: 168
Re: display todays events from event-calender on frontpage
«
Reply #19 on:
June 15, 2007, 03:42:07 PM »
Quote from: DGEC on June 15, 2007, 03:28:38 PM
Oh - wait - does it matter which calendar is this for? Do they all use the same database? I'm using EventCalendar by Keijo Karvonen v1.1.1
Yes, it does matter...
I'm not familiar with that calendar, do you have a link to it?
It is not difficult to change this to use any of the calendars, you just need to know what database table and fields to modify in the snippets.
I use a modified version of the Calendar by David ilicz Klementa, and took me five minutes to look up in my database and figure out which fields to change.
Logged
DGEC
Offline
Posts: 386
Re: display todays events from event-calender on frontpage
«
Reply #20 on:
June 15, 2007, 04:25:10 PM »
Yet Another Event Calendar. It's a Month view
Keijok did a good job of it (i.e. implementing most of my wish list
) He even has
documentation! Probably has the most documentation of anything besides showmenu2.
Not sure why it's not in the repository. Before putting in the repository, it really should have a name fully changed so it doesn't duplicate the existing EventCalendar name - if you install both, you end up with two "event calendar" entries to choose from, but at least it works.
http://forum.websitebaker.org/index.php/topic,3777.0.html
is the thread and
http://keijok.kapsi.fi/wb/pages/en/wb-modules/event-calendar.php?lang=EN
is the documentation & download page
I went in and set a fixed height for the cells, I didn't like very short days if there was nothing for the week.
Looks like he hasn't been doing much on it lately. Hmm, although he has been here recently.
Quote from: Panther on June 15, 2007, 03:42:07 PM
It is not difficult to change this to use any of the calendars, you just need to know what database table and fields to modify in the snippets.
I use a modified version of the Calendar by David ilicz Klementa, and took me five minutes to look up in my database and figure out which fields to change.
Cool, well this should be a good start for it, thanks! He has a mini-calendar view already, this will be even more useful.
Reminds me, there were a couple other things I wanted to tweak as well...
Logged
aggiedad
Offline
Posts: 57
Re: display todays events from event-calender on frontpage
«
Reply #21 on:
June 15, 2007, 11:01:59 PM »
Panther,
It works great! Thanks for the help. I am still just exploring MySQL.
Don Simmons
Logged
Panther
Offline
Posts: 168
Re: display todays events from event-calender on frontpage
«
Reply #22 on:
June 16, 2007, 05:15:30 AM »
@aggiedad
No problem, glad I could help.
I did programming for a few years waaaaay back in college, so I get the jist of things. But I know just enough javascript and php to get myself in trouble sometimes.
Logged
spawnferkel
Offline
Posts: 96
Re: display todays events from event-calender on frontpage
«
Reply #23 on:
June 17, 2007, 12:04:13 PM »
I had also installed the event calender with the month view, I thought it would be helpful for the users. But they all want the old version from the originally WebsiteBaker installation back because of the possibility to display all events on one site without any other cliks.
Bye
Logged
vis-elu
Offline
Posts: 1
Re: display todays events from event-calender on frontpage
«
Reply #24 on:
August 28, 2007, 08:56:50 AM »
Hello (@olli),
i failed to make your code work.
which header do you mean...(simply dont know where to paste it)
But
isn´t it possible just to display it in a code-area without scrolling & marquee?
Regards
Logged
Pages: [
1
]
2
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...