display todays events from event-calender on frontpage

Olli

@vis-elu: do you still have problems with the code?
sorry just accidentally read it without having topic notification turned on.

just put the javascript stuff between <head>... </head>

that should do the trick

regards

erpe0812

@spawnferkel:
where do I have to put this code in the template?
I tried to make a copy and paste to the template allcss2 but it did not worked.

erpe

DGEC

All right! Got some progress here (even fixed my FF issues - did you know FF & IE handle the absence of a BODY statement differently? Go figure). And I didn't even remember to look at the docs  :roll:

I've modified several files, but the calendar.css file is the one to get a minimum fixed height, if you want nice clean code. Just add
height: 60px;
or ems or whatever your design calls for in the calendar_day, calendar_eventday & calendar_today definitions. If that doesn't sell you on CSS... one line added to the 3 different types of cells vs adding a height to every <td> element?

I was also doing some adjusting of the font sizes and I converted the fixed pixel width to 94% or something like that (divide by 7 to get the size of the columns & adjust various fields to suit) - I had to cut the names down to short forms to get the width% to work - it's expandable, the same as the height!  (I was very confused - why are the column widths all different?? :-P) The languages/EN.php file contains the text strings for that.

You know, we probably should be discussing this in the mod_evcal thread.  Which, actually, is the point that Greg was making in his rant in the template management thread. There does need to be a wiki rather than just the message board so these kind of things could be added there and people pointed to the entries rather than rehashing multiple out-dated threads.

JTux

Thanks for the advice DGEC. I'll have a go at it but I'm pretty much a beginner with code so I'm sure how I'll go. I will post if I work it out!
Cheers,
John

DGEC

The Internet Archive's "Wayback Machine" is your friend.

Go to http://archive.org and enter the vanished page into the text box and you will shortly get a list of all the dates when they archived the page. The "*" tells you when they noticed differences in the page. Sometimes attachments like images don't get saved on one date, but do on others, so you might need to try a couple of different "identical" dates.

The first half of the documentation is how to use the calendar, the second half is CSS names and other coding display information. Cell height is not an option. Neither, is table with, I had to go in and manually set the overall table size to fit to my content width in a couple of places. Rats. I should have commented where I did that. I always forget that! I'm used to a SCL library at work, makes it easy to see where things have changed. Hmm. That would be nice to have in WB too...

As for the cell height, I forget how I did it - and I overwrote my experimental site so I have nothing to compare against.  I think I went into the php code where it writes out the table's cell definition and modified it to a set height.  Please post if you find the line to do that.
Start by looking at the view.php IIRC. 
The one problem with the modern tendency to write everything in different files is that it makes it harder to trace and find something without an IDE and debugger.

There's actually a ton of things I like to have it do differently, easist being putting the Add Event sub-form at the TOP of the page. When you have several pages worth of dates, it gets tiresome scrolling to the bottom every time. In fact, I'd like to modify it to display "pages" so that, i.e., only the current day/week/month/quarter's events are listed.
Even better, Adding or Editing events by clicking on the description or date in the calendar itself (for logged in administrators only of course) is also a vastly better interface than forcing you to the admin page all the time. The phpeventcalendar that I mentioned before is nice & easy to use like that, although it's not under development any more either and I never quite got to integrating it with WB before this one came out anyway. The project "webcalendar" is very powerful but harder to set up from what I can tell.

There's also issues with default time entry. I'd like to set a default time other than 9 - 4. And I think it was messing it up anyway, setting end time of 4 am or something - prior to the start time. Ahem. I just haven't got fixing any of that yet. I still haven't fixed my template rendering badly with FF in fact. Sigh.

JTux

Quote from: DGEC on June 15, 2007, 05:25:10 PM
Yet Another Event Calendar.  It's a Month view

....
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.

<Snipped>
Reminds me, there were a couple other things I wanted to tweak as well...

Hello DGEC,

I have started to use the Event Calendar by Keijok, but the links to his website don't work anymore so I haven't been able to find any documentation. I would like to tweak some things like the height of cells in the main calendar and the mini calendars, but I don't know where to start. Can you please give me some pointers to how you do this?

Thanks

John

vis-elu

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

spawnferkel

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

Panther

@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.

aggiedad

Panther,

It works great! Thanks for the help. I am still just exploring MySQL.

Don Simmons


DGEC

Yet Another Event Calendar.  It's a Month view

Keijok did a good job of it (i.e. implementing most of my wish list  :lol: ) He even has  :-o 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, 04: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...

Panther

Quote from: DGEC on June 15, 2007, 04:28:38 PMOh - 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.

Panther

#19
@aggiedad
I haven't tested this, but looking at the database tables, this should work...

$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...

DGEC

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.

aggiedad

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

spawnferkel

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.


Olli

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

doc

@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

Olli

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...


jschor

When this is finished can it be placed in the addons section as an "anyevent"-snippet??

Olli

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:

<head>
....
<?php $page_id PAGE_ID; if ($page_id==3) { ?>
<script ...
....
</script>
<? } ?>
</head>

bye

doc

Hi Olli,

thanks for sharing that piece of code.

Regards Christian

Olli

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:
<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)

#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
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

doc

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


kweitzel

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