hi, im creating a webcomic site (with no SQL) for a few friends. i didnt think it would be much of a problem but i have run into a few difficulties. They want the comic to be updated every monday, wednesday and friday, the code i have written for that works, you guys are php programmers so i will let the code explain itself:
<?php
//PREVIOUS BUTTON ENABLE AND PREVIOUS BUTTON LINK
$prevbutt1 = "<a href=\"";
$prevlink = $back.$arch_day.$back1.$arch_date;
$prevbutt2 = "\"><img src=\"decoration/last.gif\" border=\"0\"></a></td>";
//NEXT BUTTON ENABLE AND NEXT BUTTON LINK
$date = date(mdy);
$day2 = date(d) -1;
$oddday = $day2 +1;
if (date(w) == 0)
$evenday = date(d) -2;
else
$evenday = date(d) -1;
$daynum = date(w);
$month = date(m);
$year = date;
$cext = ".gif";
$rext = ".txt";
$pext = ".php";
$back = "back.php?arch_day=";
$next = "next.php?arch_day=";
$back1 = "&arch_date=";
$next1 = "&arch_date=";
$configdirec = "issues/config/";
$comicdirec = "issues/comics/";
$natedirec = "issues/rants/nate/";
$joshdirec = "issues/rants/josh/";
$oddcomic = $comicdirec.$month.$oddday.$year.$cext;
$evencomic = $comicdirec.$month.$evenday.$year.$cext;
$naterant = $natedirec.$date.$rext;
$joshrant = $joshdirec.$date.$rext;
$joshdirec = "issues/rants/josh/";
$oddrantjosh = $joshdirec.$month.$oddday.$year.$rext;
$evenrantjosh = $joshdirec.$month.$evenday.$year.$rext;
$oddrantnate = $natedirec.$month.$oddday.$year.$rext;
$evenrantnate = $natedirec.$month.$evenday.$year.$rext;
$prevlink = $back.$daynum.$back1.$oddday;
$nextlink = $next.$daynum.$next1.$oddday;
/*
This function takes day nubmer ($intnumber)
and then updates the comic depending on whether
it is odd or even
*/
$intNumber = date(w);
{
if ($intNumber % 2 == 0 && $intNumber < 7)
{
//The day is even
$comic = $evencomic;
$joshrant = $evenrantjosh;
$naterant = $evenrantnate;
}
else
{
//The day is odd
$comic = $oddcomic;
$joshrant = $oddrantjosh;
$naterant = $oddrantnate;
}
}
?>
you can see how that works.
here is my problem(s).
they want a back, and a next button, to take them to the past date, when they are on the last date that there is (first comic in other words) the back link will be disabled (and the gif that linked to it). Then next code takes you forward, when it gets to todays date, the next button is disabled. here is the code i have for the back links, the next link is pretty much the same, so i wont post it:
<?
//set dates
$month = date(m);
$year = date;
$curr_date = date(d);
$date_back = $arch_date;
if ($arch_day == 1)
$arch_date = $arch_date -2;
else if ($arch_day == 2)
$arch_date = $arch_date -2;
else if ($arch_day == 3)
$arch_date = $arch_date -2;
else if ($arch_day == 4)
$arch_date = $arch_date -2;
else if ($arch_day == 5)
$arch_date = $arch_date -2;
else if ($arch_day == 6)
$arch_date = $arch_date -2;
else if ($arch_day == 0)
$arch_date = $arch_date -4;
//format the date month-day-year
$archive = $month.$arch_date.$year;
//set directories
$cext = ".gif";
$rext = ".txt";
$pext = ".php";
$comicdirec = "issues/comics/";
$natedirec = "issues/rants/nate/";
$joshdirec = "issues/rants/josh/";
$comic = $comicdirec.$archive.$cext;
$naterant = $natedirec.$archive.$rext;
$joshrant = $joshdirec.$archive.$rext;
$back = "back.php?arch_day=";
$next = "next.php?arch_day=";
$back1 = "&arch_date=";
$next1 = "&arch_date=";
$arch_day = $arch_day -1;
if ($arch_day < 0)
$arch_day = "6";
else
$arch_day = $arch_day;
//PREVIOUS BUTTON ENABLE AND PREVIOUS BUTTON LINK
$prevbutt1 = "<a href=\"";
$prevlink = $back.$arch_day.$back1.$arch_date;
$prevbutt2 = "\"><img src=\"decoration/last.gif\" border=\"0\"></a></td>";
//NEXT BUTTON ENABLE AND NEXT BUTTON LINK
$nextbutt1 = "<a href=\"";
$nextlink = $next.$arch_day.$next1.$arch_date;
$nextbutt2 = "\"><img src=\"decoration/next.gif\" border=\"0\"></a></td>";
//now we include the template so we can show da comix
echo $arch_date;
echo "<br>";
echo $arch_day;
//INSERT TEMPLATES
include ('templates/header.php');
echo "<br>";
//CURRENT COMIC TO BE DISPLAYED
include ('templates/main.php');
echo "<br>";
include ('navigation/botnavi.php');
echo "<br>";
//CURRENT RANTS TO BE DISPLAYED
include ('templates/rants.php');
echo "<br>";
include ('templates/footer.php');
$archive = "";
?>
problem is, that doesnt work, it takes me back too far one day sometimes (almost as if when php wants to work, it will) it has do do with the current day, but if it is subtracted by 1 everytime, i cant se that there would be any problems.
please consider helping me out, thanks,
-kpdvx
<?php
//PREVIOUS BUTTON ENABLE AND PREVIOUS BUTTON LINK
$prevbutt1 = "<a href=\"";
$prevlink = $back.$arch_day.$back1.$arch_date;
$prevbutt2 = "\"><img src=\"decoration/last.gif\" border=\"0\"></a></td>";
//NEXT BUTTON ENABLE AND NEXT BUTTON LINK
$date = date(mdy);
$day2 = date(d) -1;
$oddday = $day2 +1;
if (date(w) == 0)
$evenday = date(d) -2;
else
$evenday = date(d) -1;
$daynum = date(w);
$month = date(m);
$year = date;
$cext = ".gif";
$rext = ".txt";
$pext = ".php";
$back = "back.php?arch_day=";
$next = "next.php?arch_day=";
$back1 = "&arch_date=";
$next1 = "&arch_date=";
$configdirec = "issues/config/";
$comicdirec = "issues/comics/";
$natedirec = "issues/rants/nate/";
$joshdirec = "issues/rants/josh/";
$oddcomic = $comicdirec.$month.$oddday.$year.$cext;
$evencomic = $comicdirec.$month.$evenday.$year.$cext;
$naterant = $natedirec.$date.$rext;
$joshrant = $joshdirec.$date.$rext;
$joshdirec = "issues/rants/josh/";
$oddrantjosh = $joshdirec.$month.$oddday.$year.$rext;
$evenrantjosh = $joshdirec.$month.$evenday.$year.$rext;
$oddrantnate = $natedirec.$month.$oddday.$year.$rext;
$evenrantnate = $natedirec.$month.$evenday.$year.$rext;
$prevlink = $back.$daynum.$back1.$oddday;
$nextlink = $next.$daynum.$next1.$oddday;
/*
This function takes day nubmer ($intnumber)
and then updates the comic depending on whether
it is odd or even
*/
$intNumber = date(w);
{
if ($intNumber % 2 == 0 && $intNumber < 7)
{
//The day is even
$comic = $evencomic;
$joshrant = $evenrantjosh;
$naterant = $evenrantnate;
}
else
{
//The day is odd
$comic = $oddcomic;
$joshrant = $oddrantjosh;
$naterant = $oddrantnate;
}
}
?>
you can see how that works.
here is my problem(s).
they want a back, and a next button, to take them to the past date, when they are on the last date that there is (first comic in other words) the back link will be disabled (and the gif that linked to it). Then next code takes you forward, when it gets to todays date, the next button is disabled. here is the code i have for the back links, the next link is pretty much the same, so i wont post it:
<?
//set dates
$month = date(m);
$year = date;
$curr_date = date(d);
$date_back = $arch_date;
if ($arch_day == 1)
$arch_date = $arch_date -2;
else if ($arch_day == 2)
$arch_date = $arch_date -2;
else if ($arch_day == 3)
$arch_date = $arch_date -2;
else if ($arch_day == 4)
$arch_date = $arch_date -2;
else if ($arch_day == 5)
$arch_date = $arch_date -2;
else if ($arch_day == 6)
$arch_date = $arch_date -2;
else if ($arch_day == 0)
$arch_date = $arch_date -4;
//format the date month-day-year
$archive = $month.$arch_date.$year;
//set directories
$cext = ".gif";
$rext = ".txt";
$pext = ".php";
$comicdirec = "issues/comics/";
$natedirec = "issues/rants/nate/";
$joshdirec = "issues/rants/josh/";
$comic = $comicdirec.$archive.$cext;
$naterant = $natedirec.$archive.$rext;
$joshrant = $joshdirec.$archive.$rext;
$back = "back.php?arch_day=";
$next = "next.php?arch_day=";
$back1 = "&arch_date=";
$next1 = "&arch_date=";
$arch_day = $arch_day -1;
if ($arch_day < 0)
$arch_day = "6";
else
$arch_day = $arch_day;
//PREVIOUS BUTTON ENABLE AND PREVIOUS BUTTON LINK
$prevbutt1 = "<a href=\"";
$prevlink = $back.$arch_day.$back1.$arch_date;
$prevbutt2 = "\"><img src=\"decoration/last.gif\" border=\"0\"></a></td>";
//NEXT BUTTON ENABLE AND NEXT BUTTON LINK
$nextbutt1 = "<a href=\"";
$nextlink = $next.$arch_day.$next1.$arch_date;
$nextbutt2 = "\"><img src=\"decoration/next.gif\" border=\"0\"></a></td>";
//now we include the template so we can show da comix
echo $arch_date;
echo "<br>";
echo $arch_day;
//INSERT TEMPLATES
include ('templates/header.php');
echo "<br>";
//CURRENT COMIC TO BE DISPLAYED
include ('templates/main.php');
echo "<br>";
include ('navigation/botnavi.php');
echo "<br>";
//CURRENT RANTS TO BE DISPLAYED
include ('templates/rants.php');
echo "<br>";
include ('templates/footer.php');
$archive = "";
?>
problem is, that doesnt work, it takes me back too far one day sometimes (almost as if when php wants to work, it will) it has do do with the current day, but if it is subtracted by 1 everytime, i cant se that there would be any problems.
please consider helping me out, thanks,
-kpdvx