Can you add the current date into a menu?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Can you add the current date into a menu?

Post by pbyrne »

I'm wondering if there is an easy way to incorporate a current date into the menu.

For reference, my draft menu is at: http://www.dracoblu.com/testindex.html

I wish to place a current date in the horizontal menu aligned to the far right.

If anyone has suggestions it would be greatly appreciated.

Thanks, Pat
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

You can use the menuclock.js module and set up a current date and time. I will check to see if it's possible to get it to only set the date and post back when I find out. You can find a demo of it under the demos, it will be the 2nd one under the bolt-on module demos at the bottom. Make sure you download the newest menuclock.js file. There is a link for it at the bottom of the clock demo page.

http://support.milonic.com/demos/

One thing to note, since you are putting the menu into a div, there's really no way to get the date to be aligned to the right unless you change the layout to have two separate menus in their own divs or put a two column table into that div and put the clock data file into the right had column. For example:

Code: Select all

<DIV class=topnav id=nav><table width="100%"; cellpadding=0 cellspacing=0 border=0>
<tr>
       <td><SCRIPT language=javascript src="embed_main.js" 
type=text/javascript></SCRIPT></td>
       <td><SCRIPT language=javascript src="clock_main.js" 
type=text/javascript></SCRIPT></td>
</tr>
</table>

</DIV>
Your clock_main.js would be

Code: Select all

with(milonic=new menuname("clock")){
style=style1;
alwaysvisible=1;
orientation="horizontal";
position="relative";
aI("valign=top;text="+getMilonicDate()+";align=right;type=clock;offbgcolor=#000000;onbgcolor=#000000;offcolor=#ffffff;oncolor=#ffffff;");

}

drawMenus();
And you would need to add the menuclock.js module call like this before you menu_data file

Code: Select all

<SCRIPT language=Javascript src="menuclock.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="bonesingermenu_data.js" 
type=text/javascript></SCRIPT>
Hope this helps.

Ruth
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks Ruth. I will investigate this, but if you find a date only module, that would be ideal.

Enjoy a great weekend.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Normally I would not do modifications since in most cases I wouldn't know how. But, since I figured this one out and Andy said it was OK you can get date only like this.

Download the menuclock.js file and open it in a text editor. Find this line

Code: Select all

return dayNames[_dayNum]+" "+_day+getNumberSuffix(_day)+" " + monthNames[_month] + " " + _year + "<BR><b>" + _time+"</b>"
And change it to this

Code: Select all

return dayNames[_dayNum]+" "+_day+getNumberSuffix(_day)+" " + monthNames[_month] + " " + _year + " "
And now you have only the date. :)

Ruth
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks Ruth. I have incorporate the code into the menu at: http://www.dracoblu.com/testindex.html

A couple of problems I have noticed....The date appears as a hyperlink with an error of: javascript:void(0) in both FF and IE. I also notice that in IE the horizontal menu bar is double with width than it is in FF. I am not sure why...if you have any suggestions that would be great.

Thanks, Pat.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

It's something built in about the form. It's as if the form automatically puts a br after the form close tag, I think it's some kind of margin because setting margin in the aI fixes it.

Code: Select all

aI("text=`<form><input><input>&nbsp;<input></form>`;type=form;");
That seems to eliminate that extra space.

Ruth
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Interesting.... I can't seem to make that extra horizontal disappear in IE by putting in &nbsp; I am running IE6

Any thoughts on that other JS error related to the date?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Interesting, the code buttons don't seem to be working right.

Ok I'm changing your < brackets to [ so I can post the code. Don't forget to change them back to <and>

Code: Select all

aI("text=`[form style='margin:0px;' method=get action=http://search.atomz.com/search/]
I'm not sure what's going on I'll have to post to Andy.

Ruth
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

Here's how to get rid of the extra space:

Code: Select all

aI("text=`<form><input>&nbsp;<input>&nbsp;<input></form>`;type=form;");
Here's a fix for the error, you had 2 hashes for the oncolor:

Code: Select all

aI("valign=top;text="+getMilonicDate()+";align=right;type=clock;offbgcolor=#003366;onbgcolor=#003366;offcolor=#ffffff;oncolor=#ffffff;");
Not much we can do about the javascript:viod problem because the link is being echoed to the status bar to indicate where the link supposed to be linking to, it's a security thing.

-- Andy
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks Andy.... I did not see your reply right away, so it has been a few days.

I removed the extra hash mark in the clock_main.js, and inserted the no break space a few different ways in the embed_main.js file, but I cannot seem to remove the extra horizontal space in IE. Here is the current code I have associated with http://www.dracoblu.com/testindex.html

aI("text=`<form method=get action=http://search.atomz.com/search/> <input type=submit value=Search style='color: #010425; font-family: arial; font-size: 11px' /> <input type=hidden name=sp-a id=sp-a value=sp10015b5a /> <input type=text size=20 name=sp-q id=sp-q style='color: #010425; background-color: #eeeeee; font-family: arial; font-size: 11px' /></form>`;type=form;");
}

Any help would be appreciated. Thanks, Pat.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

IE7 really messes things up (including the rounded corner box!).

Looking at it now but now sure if I can help, as I no longer have IE6.
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks John... I have not played with IE7, so if you have any suggestions that would be great. It is still in beta, right?...Maybe that will make a difference.

This is a bit off topic, I will be trying to make this a CSS compliant website. Do you have a CSS alternative to a table for this part of the code calling the menu and clock?

<div class="topnav" id="nav"><table width="100%"; cellpadding=0 cellspacing=0 border=0>
<tr>
<td><SCRIPT language=javascript src="embed_main.js"
type=text/javascript></SCRIPT></td>
<td><SCRIPT language=javascript src="clock_main.js"
type=text/javascript></SCRIPT></td>
</tr>
</table>
</div>

Thanks again.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

No, both IE7 and FF2 are now final releases - well, depending on just how 'final' a first release can be... :roll:

Can't help you with the script to CSS thing. Sorry.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I don't know what you mean by something different than the table. If you correct the errors the page will validate.

I don't do xhtml but I did get it to validate after fiddling until I could figure out what the errors were. that shorttag=yes I finally found was that you had to put quotes around things like class=topnav, cellpadding=0, type=text/javascript. I believe you can remove the language=javascript from the calls for the two files that were causing problems

Code: Select all

<script src="embed_main.js" type='text/javascript'></script>
It seems to still work, but I don't have all browsers to check it.

Ruth
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks for the reply, Ruth.

I have played with removal of the language=javascript command, but that does not change the display of the menu search in a two line block in IE7. FF displays properly.

The current draft can be viewed at:

http://www.dracoblu.com/testindex1.html
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

My response was to the validation.

You did not include the style and margin: 0px in the form which was how I got rid of the extra space.


EDIT: Link Removed

Ruth
Last edited by Ruth on Thu Nov 30, 2006 6:44 am, edited 1 time in total.
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks Ruth. I got the files, and inserted the style for the form. It works!

I have not eliminated the idea of a date in the menu. I am trying to avoid a table to call the clock_main.js or another similar JS file that I have on hand called date.js ...The CSS is not co-operating and placing the info behind the menu.

Thanks again for you help. I really appreciate it.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Well, I really don't do any real css since there is no place that gives you explanations that are easy to understand and visuals to see what's happening when you change things so you can see how they work, absolute, relative, fixed static and so on and so on and oh if borders meet then this happens and that happens. Sorry that the table is the only way I know to do it that I can position correctly. When they create something that makes sense as to divs and positioning them I'll do more css :)

However, for those who know css, divs and positioning, I'd think one should be able to place two divs side by side one for the menu one for the date right where you have the one div now into which I put the 'oh so easy to configure and put where you want it so it will stay there' table. ;)

Ruth
pbyrne
Advanced
Advanced
Posts: 12
Joined: Tue Oct 17, 2006 7:11 am

Post by pbyrne »

Thanks Ruth... I know what you mean.

I will continue to work on it.
wuscheck
Advanced
Advanced
Posts: 16
Joined: Tue Aug 26, 2003 8:07 am

Re: Can you add the current date into a menu?

Post by wuscheck »

Hi ruth,

I have a question concerning menuclock.js... What is the right place for the

Code: Select all

<SCRIPT language=Javascript src="menuclock.js" type=text/javascript></SCRIPT>
when I'm using the php-version of milonic because there is no

Code: Select all

<SCRIPT language=Javascript src="menu_data.js" type=text/javascript></SCRIPT>
Is this the right way to call the clock after placing the scipt-code in the right way?

Code: Select all

$mmMenu->addItemFromText("text=`+getMilonicDate()+`;align=center;type=clock;");
Thanks in advance...

wuscheck
Post Reply