Arrow

Adding more years? | Peter's Sports League Standings | Forum

Back to the sports standings script page
 
Current User: Guest
Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Adding more years?

Reply to Post Add a New Topic
UserPost

8:51 pm
October 2, 2010


Jason

Guest

Currently the "Add New Game" form only displays 3 years to choose from. Is there a way to change it so that it shows more than 3 years (eg 2005 – 2011)? Thanks.

7:45 pm
October 3, 2010


Peter

Admin

posts 732

In admin_files/add_score.php you'll see this code:

<select name="year[]">

You can hardcode the year options below that code or do some sort of foreach loop to output a certain number of years. Something similar would have to be done in admin_files/edit_score.php as well.

4:59 am
October 4, 2010


Jason

Guest

Hey Peter. Thanks for the quick reply.

I had tried hard-coding the years I needed before posting this question, but it seems as though the years are based off a Unix Timestamp. When I hard-coded 2005, 2006, 2007 and 2008 in, the years showed up as 2001 when viewed from the site /admin area.

10:34 pm
October 4, 2010


Peter

Admin

posts 732

Followed up via e-mail. Will post results when we get them.

4:36 am
October 5, 2010


Jason

Guest

Thanks Peter. Email has been sent.

8:32 am
October 6, 2010


Peter

Admin

posts 732

Here's the code for the expanded year dropdowns as given to Jason, although this forum strips the indents:

admin_files/add_score.php

<select name="year[]">
<?php
// Max year is this year + 1. Start year is 2000
$thisyear = date( 'Y' ) + 1;
for( $outputyear = 2000; $outputyear <= $thisyear; $outputyear++ )
{
print '<option value="' . $outputyear . '">' . $outputyear . '</option>';
}
?>
</select>

admin_files/edit_score.php

<select name="year">
<?php
// Max year is this year + 1. Start year is 2000
$thisyear = date( 'Y' ) + 1;
for( $outputyear = 2000; $outputyear <= $thisyear; $outputyear++ )
{
print '<option value="' . $outputyear . '"';
if( $year == $outputyear )
{
print ' selected="selected"';
}
print '>' . $outputyear . '</option>';
}
?>
</select>
Reply to Post

Reply to Topic:
Adding more years?

Guest Name (Required):

Guest Email (Required):

HTML Editor
Smileys
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell
Post New Reply

Guest URL (required)

Math Required!
What is the sum of:
8 + 1