|
-
Oct 2nd, 2004, 06:20 PM
#1
Thread Starter
Fanatic Member
[resolved]Calendar navigation
I'm making a calendar but I'm having troubles with the navigation. I want it to look like this:
Code:
<< 1 >>
<< October >>
<< 2004 >>
The thing is that I don't want to use tables, but I do want it to work even if the user doesn't use stylesheets. Any ideas anyone?
//Tobbe
Last edited by McCain; Oct 11th, 2004 at 10:03 AM.
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 3rd, 2004, 12:12 PM
#2
You could make it so that it degrades if the user doesn't use stylesheets. To something like
<< 1 >>
<< October >>
<< 2004 >>
It's not as beautiful, but that's HTML without CSS: not beautiful.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 3rd, 2004, 04:43 PM
#3
Thread Starter
Fanatic Member
Yeah, that's exactly what I want, but I can't make it work
When I disable the css I got right now I get this:
<<
<<
<<
1
October
2004
>>
>>
>>
And that is not good enough...
Last edited by McCain; Oct 3rd, 2004 at 05:14 PM.
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 4th, 2004, 12:05 AM
#4
Thread Starter
Fanatic Member
The code I have right now, that I don't think is good enough looks like this:
Code:
<div id="datenav">
<div class="left">
<a href="./calendar.php?day=<?php echo $aDay-1;?>&month=<?php echo $aMonth;?>&year=<?php echo $aYear;?>"><<</a><br />
<a href="./calendar.php?day=<?php echo $aDay;?>&month=<?php echo $aMonth-1;?>&year=<?php echo $aYear;?>"><<</a><br />
<a href="./calendar.php?day=<?php echo $aDay;?>&month=<?php echo $aMonth;?>&year=<?php echo $aYear-1;?>"><<</a><br />
</div>
<div class="middle">
<?php echo $aDay ?><br />
<?php echo $sweMonths[$aMonth - 1] ?><br />
<?php echo $aYear ?><br />
</div>
<div class="right">
<a href="./calendar.php?day=<?php echo $aDay+1;?>&month=<?php echo $aMonth;?>&year=<?php echo $aYear;?>">>></a><br />
<a href="./calendar.php?day=<?php echo $aDay;?>&month=<?php echo $aMonth+1;?>&year=<?php echo $aYear;?>">>></a><br />
<a href="./calendar.php?day=<?php echo $aDay;?>&month=<?php echo $aMonth;?>&year=<?php echo $aYear+1;?>">>></a><br />
</div>
</div>
And here's the CSS:
Code:
div#datenav
{
position: relative;
line-height: 1.8em;
width: 12em;
margin: auto;
padding-bottom: 20px;
text-align: left;
}
div#datenav div.left
{
position: relative;
left: 0;
top: 0;
width: 2em;
font-weight: bolder;
}
div#datenav div.middle
{
position: absolute;
left: 2em;
top: 0;
width: 8em;
text-align: center;
}
div#datenav div.right
{
position: absolute;
left: 10em;
top: 0;
width: 2em;
font-weight: bolder;
}
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 4th, 2004, 01:07 AM
#5
So reorder it:
Code:
<div class="calnavline">
<a class="calnavback" href="..."><<</a>
<span class="calnavnum">$day</span>
<a class="calnavfwd" href="...">>></a>
<!-- This is an unfortunate necessity in IE:
<br class="clearer"/>
</div>
<div class="calnavline">
<a class="calnavback" href="..."><<</a>
<span class="calnavnum">$month</span>
<a class="calnavfwd" href="...">>></a>
<!-- This is an unfortunate necessity in IE:
<br class="clearer"/>
</div>
<div class="calnavline">
<a class="calnavback" href="..."><<</a>
<span class="calnavnum">$year</span>
<a class="calnavfwd" href="...">>></a>
<!-- This is an unfortunate necessity in IE:
<br class="clearer"/>
</div>
CSS:
.calnavback, .calnavfwd {
float: left;
width: 3em;
text-align: center;
}
.calnavnum {
float: left;
width: 7em;
text-align: center;
}
.clearer {
clear: both;
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 4th, 2004, 03:00 AM
#6
Thread Starter
Fanatic Member
Thank you, I will try it as soon as I get home
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 4th, 2004, 02:55 PM
#7
Thread Starter
Fanatic Member
Worked like a charm (not that I expected anything else, comming from you and all...)
Thanks
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 11th, 2004, 03:40 AM
#8
Thread Starter
Fanatic Member
I tried the code you gave me in IE6 today. I couldn't believe my eyes! This is what it looks like:

Where does the extra > come from?
This is the code:
Code:
<div id="datenav">
<div class="calnavline">
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'day', -1);?>" class="calnavback"><<</a>
<span class="calnavnum"><?php echo $aDay ?></span>
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'day', +1);?>" class="calnavfwd">>></a>
<!-- This is an unfortunate necessity in IE: -->
<br class="clearer" />
</div>
<div class="calnavline">
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'month', -1);?>" class="calnavback"><<</a>
<span class="calnavnum"><?php echo $sweMonths[$aMonth - 1] ?></span>
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'month', +1);?>" class="calnavfwd">>></a>
<!-- This is an unfortunate necessity in IE: -->
<br class="clearer" />
</div>
<div class="calnavline">
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'year', -1);?>" class="calnavback"><<</a>
<span class="calnavnum"><?php echo $aYear ?></span>
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'year', +1);?>" class="calnavfwd">>></a>end
</div>
</div>
Code:
div#datenav
{
position: relative;
line-height: 1.8em;
width: 13em;
margin: auto;
padding-bottom: 20px;
text-align: left;
}
div#datenav a
{
color: #765;
text-decoration: none;
}
div#datenav a:hover
{
color: #000;
}
.calnavback, .calnavfwd
{
float: left;
width: 3em;
text-align: center;
font-weight: bolder;
}
.calnavnum
{
float: left;
width: 7em;
text-align: center;
}
.clearer
{
clear: both;
}
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 11th, 2004, 03:43 AM
#9
If you're using a HTML doctype, I'd say it comes from an actually correct SGML parse of the HTML code, thus making the > in <br /> show up. The weird thing about "HTML-compatible" XHTML 1.0 is that it relies on a parsing bug in what I thought was every single generic web browser available.
If you're using a HTML doctype, use the normal <br>. If you're using an XHTML doctype - perhaps you shouldn't. IE doesn't support XHTML anyway, it only pretends it does.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 11th, 2004, 03:49 AM
#10
Thread Starter
Fanatic Member
I'm using xhtml
But if I change "class="calnavfwd">>></a>" to "class="calnavfwd">bb</a>" it will show a 'b' on the next line.
Last edited by McCain; Oct 11th, 2004 at 03:53 AM.
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 11th, 2004, 03:57 AM
#11
Oh, then it's a layout bug. It might even be one I've heard of. Let me think...
Found it:
http://www.positioniseverything.net/...haracters.html
Apparently you need to remove the comments.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 11th, 2004, 04:10 AM
#12
Thread Starter
Fanatic Member
I removed the comments. Didn't help.
The code:
Code:
<div id="datenav">
<div class="calnavline">
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'day', -1);?>" class="calnavback"><<</a>
<span class="calnavnum"><?php echo $aDay ?></span>
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'day', +1);?>" class="calnavfwd">>></a>
<br class="clearer" />
</div>
<div class="calnavline">
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'month', -1);?>" class="calnavback"><<</a>
<span class="calnavnum"><?php echo $sweMonths[$aMonth - 1] ?></span>
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'month', +1);?>" class="calnavfwd">>></a>
<br class="clearer" />
</div>
<div class="calnavline">
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'year', -1);?>" class="calnavback"><<</a>
<span class="calnavnum"><?php echo $aYear ?></span>
<a href="./calendar.php?<?php echo newLinkDate($aDay, $aMonth, $aYear, 'year', +1);?>" class="calnavfwd">bb</a>end
</div>
</div>
Still the same CSS
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Oct 11th, 2004, 04:47 AM
#13
Thread Starter
Fanatic Member
I have no idea what caused the bug, but I have fixed it by doing what they suggested att pie.
Fixes and Workarounds
One easy fix is to put a -3px right margin on the last left float.
So I changed my CSS to this:
Code:
.calnavback, .calnavfwd
{
float: left;
width: 3em;
text-align: center;
font-weight: bolder;
margin-right: -3px;
}
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|