boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hover Calendar

 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
Gadget Girl



Joined: 25 Jan 2002
Posts: 305
Location: Virginia

PostPosted: Wed Oct 23, 2002 4:00 pm    Post subject: Hover Calendar Reply with quote

I saw this the other day and it's way cool!

http://blogstyles.com/mt/hovercalendar.php

Can it be done with b2? Anyone up to the challenge?

Sara
Back to top
View user's profile Send private message
GamerZ



Joined: 15 May 2002
Posts: 537
Location: Singapore

PostPosted: Wed Oct 23, 2002 4:32 pm    Post subject: Reply with quote

erm, pardon me, but i find it quite irrating LOL
_________________

++ GamerZ.Per.Sg - Complex Simplicity
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Gadget Girl



Joined: 25 Jan 2002
Posts: 305
Location: Virginia

PostPosted: Wed Oct 23, 2002 4:36 pm    Post subject: Reply with quote



Well, I would think that it would appeal to some, maybe on a page with very little??

Anyhow, anyone want to see if they can get it to work, I'm interested in this for many different reasons.

Thanks!!

Sara
Back to top
View user's profile Send private message
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Thu Oct 24, 2002 9:12 am    Post subject: Reply with quote

This is pretty straight forward, you just have to set up the PHP to generate a bunch of JavaScript and DHTML. I could help you if you need it, basically a for loop that querys mysql and prints out the entry titles for each day, wrapped in DIV tags with style="display: none;" so they start off hidden. Then you need a JS function to show the appropriate list when you mouseover the date.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Gadget Girl



Joined: 25 Jan 2002
Posts: 305
Location: Virginia

PostPosted: Thu Oct 24, 2002 11:45 am    Post subject: Reply with quote

Alex, that would be great as I'm so new to .php and I know nothing about programming languages! Smile Thank you for your offer of help! Feel free to email me if you need to.

Sara
Back to top
View user's profile Send private message
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Fri Oct 25, 2002 6:37 am    Post subject: Reply with quote

I've got this working, it requires only a slight change to the current b2_calendar.php code and then the addition of some code at the end, or wherever you want your hover to show up. This should work on most browsers - let me know if you find a problem.

The modification - line 160:
Code:
         echo '<a href="'.$siteurl.'/'.$blogfilename.'?m='.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost">';

becomes
Code:
         echo '<a onmouseover="showDayTitles(\''.date('d',$i).'\');" onmouseout="hideDayTitles(\''.date('d',$i).'\');" href="'.$siteurl.'/'.$blogfilename.'?m='.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost">';


this needs to be in the page somewhere (the style is really optional):
Code:
<style>
<!--

.b2cal_titleshack_titles {
   font-family: verdana;
   font-size: x-small;
}

// -->
</style>
<script language="JavaScript">
<!--

function showDayTitles(day) {
   dayDiv = document.getElementById('titles_' + day);
   dayDiv.style.display = "block";
}

function hideDayTitles(day) {
   dayDiv = document.getElementById('titles_' + day);
   dayDiv.style.display = "none";
}

// -->
</script>


then add this wherever you want the titles to show up:
Code:
<?

// var names are kind of long to try to avoid conflicts

$days_array = explode("-", $daysinmonthwithposts);

foreach ($days_array as $day_w_post) {
   if ($day_w_post != "") {
      print('<div style="display: none;" id="titles_'.$day_w_post.'">');
      $days_result = mysql_query("SELECT post_title, post_date FROM $tableposts WHERE YEAR(post_date) = '$thisyear' AND MONTH(post_date) = '$thismonth' AND DAYOFMONTH(post_date) = '$day_w_post'");
      print('<p class="b2cal_titleshack_titles">');
      while($temp = mysql_fetch_row($days_result)) {
         print($temp[0].'<br>');
      }
      print('</div>');
   }
}

?>


email or message me if you want to see an example of this - I have one online, but my site isn't live yet so I'm not ready to post it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Fri Oct 25, 2002 7:23 am    Post subject: Reply with quote

Forgot to mention, this is almost begging for more features... the obvious one would be to make the display of the titles sticky and have each title have a direct link to the entry.

Lots of different ways to customize/hack this from the point it is at now...
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Gadget Girl



Joined: 25 Jan 2002
Posts: 305
Location: Virginia

PostPosted: Fri Oct 25, 2002 10:31 am    Post subject: Reply with quote

Thank you! Wow, I'm amazed that you could do this, awesome job!

Yup, I think there can be many things done with it.

Don't forget to post it in the hacks section!

Smile Sara
Back to top
View user's profile Send private message
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Fri Oct 25, 2002 4:02 pm    Post subject: Reply with quote

Gadget Girl wrote:
Don't forget to post it in the hacks section!


Let's make sure it's working for you first Smile
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Sat Oct 26, 2002 11:04 am    Post subject: Reply with quote

macshack was kind enough to review the code for me and he found this bug:

Code:
 echo '<a onmouseover="showDayTitles(\''.date('d',$i).'\');" onmouseout="hideDayTitles(\''.date('d',$i).'\');" href="'.$siteurl.'/'.$blogfilename.'?m='.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost">';


should be:

Code:
 echo '<a onmouseover="showDayTitles(\''.date('j',$i).'\');" onmouseout="hideDayTitles(\''.date('j',$i).'\');" href="'.$siteurl.'/'.$blogfilename.'?m='.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost">';


now the days have leading zeros as they should.

He also had some good points about how best to package this which I'll address when I get a chance. Basically, the 2 issues:

1. This is tied so tightly with the existing calendar, does it supplement (separate file, stand alone) or act as an optional replacement (include/reference existing b2calendar.php)?

2. Hiding and showing the titles could cause content beneath the "title show" area to bounce if it isn't accounted for properly.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Fri Nov 22, 2002 2:54 am    Post subject: Reply with quote

Here is another solution for showing post titles on mouseover using tooltips in this thread.

I like this one better personally and am actually using it on my site.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group