View previous topic :: View next topic |
Author |
Message |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Wed Oct 23, 2002 4:32 pm Post subject: |
|
|
erm, pardon me, but i find it quite irrating LOL _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Wed Oct 23, 2002 4:36 pm Post subject: |
|
|
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 |
|
 |
alex_t_king
Joined: 09 Oct 2002 Posts: 194
|
Posted: Thu Oct 24, 2002 9:12 am Post subject: |
|
|
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 |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Thu Oct 24, 2002 11:45 am Post subject: |
|
|
Alex, that would be great as I'm so new to .php and I know nothing about programming languages! Thank you for your offer of help! Feel free to email me if you need to.
Sara |
|
Back to top |
|
 |
alex_t_king
Joined: 09 Oct 2002 Posts: 194
|
Posted: Fri Oct 25, 2002 6:37 am Post subject: |
|
|
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 |
|
 |
alex_t_king
Joined: 09 Oct 2002 Posts: 194
|
Posted: Fri Oct 25, 2002 7:23 am Post subject: |
|
|
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 |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Fri Oct 25, 2002 10:31 am Post subject: |
|
|
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!
Sara |
|
Back to top |
|
 |
alex_t_king
Joined: 09 Oct 2002 Posts: 194
|
Posted: Fri Oct 25, 2002 4:02 pm Post subject: |
|
|
Gadget Girl wrote: | Don't forget to post it in the hacks section! |
Let's make sure it's working for you first  _________________ Yahoo! Messenger ID: alex_t_king |
|
Back to top |
|
 |
alex_t_king
Joined: 09 Oct 2002 Posts: 194
|
Posted: Sat Oct 26, 2002 11:04 am Post subject: |
|
|
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 |
|
 |
alex_t_king
Joined: 09 Oct 2002 Posts: 194
|
Posted: Fri Nov 22, 2002 2:54 am Post subject: |
|
|
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 |
|
 |
|