> Does anyone know of a well written example of this? I have seen so many
> examples, but the over head just seems to be too much... does anyone have a
> smooth and well written routine?
> Regards,
> Kunal Jhunjhunwala

I think this may help out.  I wrote a site that has a daily devotional on
it, and contains links to previous and next days.  Here's the code:

// assume that $month, $day, $year, contain the current month, day, year
// could also use direct calls to date() instead, if this is for today
list ($prev_year, $prev_month, $prev_day) =
  split (" ", date("Y m d", mktime(0,0,0,$month,$day-1,$year)));
list ($next_year, $next_month, $next_day) =
  split (" ", date("Y m d", mktime(0,0,0,$month,$day+1,$year)));

// build your links
// this will, of course, change with your dating schema
$prev_link = "http://yourdomain.com/?$prev_year-$prev_month-$prev_day;
$next_link = "http://yourdomain.com/?$next_year-$next_month-$next_day;

// display them
print "<a href=\"$prev_link\">yesterday</a><br>";
print "<a href=\"$next_link\">tomorrow</a>";

This doesn't take into account whether or not yesterday or tomorrow's
objects or files or whatever actually exists.  Since that is
site-specific, you'll need to add that sort of logic yourself.

Hope that helps!

[ joel boonstra | [EMAIL PROTECTED] ]

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to