Hi all,
Am going mad trying to get something to work.
I'm creating a CMS for a magazine. The magazine is published every 2 months and therefore the edition is nov-dec or jan-feb etc.
I've an archive option on the site and rather than listing:
dec
nov
oct
sept etc
I'd like to follow the magazine editions:
nov-dec
sept-oct
The code I have so far is:
echo '<p>Sort By:</p>';
$year = date("Y"); //get the current year
$startDate = "1 january".$year; // set the end date to current year
function printMonths($var)
{
$start = strtotime($var); //timestamp of the entered date
$now = strtotime("Now"); //timestamp of now so it does not write anything in the future
while ($now > $start) //while the start is less than now
{
echo '<a href="news_archive.php?s=&id=' . get_id() . '&month=' . date("F", $now) .'">'.date("F", $now).'</a>';
echo " | ";
$now = strtotime("-1 month", $now); // subtract a month from the start timestamp
}
}
printMonths($startDate); //execute the function
this works well listing the months from the current month back. But this is not what I need. If I alter the line
$now = strtotime("-1 month", $now);
to
$now = strtotime("-2 month", $now);
It starts in Nov and goes back to sept which is not right. It also doesn't show nov-dec etc.
Any help on this is much appreciated
PHP template help
Ok, I don't know if anyone can help me but I am using PHP templates to make a site. I am a newbie and so I am finding this quite difficult so I thought I would ask some folks much better than me. I
keeps going back to index.html ???????
ok so i started making my site using mostly.html files now i have added a fair chunk of php. My index,html file had to be renamed to index.php because i am using a include function, I got told that if
XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, here's the XML<categories> <category id="12345">
remove trailing slash from array
I have the following array which contains trailing slashes I need to remove. What is the best way to accomplish this?Array ( [Field1] => A [Field2] => Test [Field3] =>
Career Change into SAP
Hai
Help If user voted, block them
On my Prayer request site, i let users Click a button to Pray for somone that has posted a pray, i got that all set up but.Code: // connect to db... if ($_GET['id']) { $id = (int) $_GET['id'];
PHP and XML image gallery variable issue
I'm trying to display the large image on the same page as the thumbnails, to do that I'm passing a variable called $current. I know that the code to display large image works, because it works when no
quick basic question, hopefully not dumb
I don't know how to search for this, so forgive me if it's been covered...I often see an example like this:$a = $b . " " . $c; // concatenate strings with spaceI'm wondering if there is
PHP search multiple input field box help
I am having a problem with my search script. At current it will simply search by a selected date which is a java based calendar that displays when using id='datedisplay' in the input form field below.
Wierd echo error?
Hi, i got the most wierd php error ever and i don't know why..Code: echo "<td><strong>MP:</strong></td>"; echo