PDA

View Full Version : Filter listmode for year?


neubeedoo
11-06-2005, 01:36 PM
I have the calendar up on a site that need to archive their events in a particular way.

I currently have a ListMode on page that is set to lists all the events for the current year for a particular category. I do not need the filter plug in for a category change, as this category will never change.

But I would like some kind of dropdown YEAR selection - so that it shows the current year, but can view the previous year list by selecting the year in a dropdown -
<?php $LIST=1; $DF = "M d Y - l"; $listYear = "2005";
$template="modern1_2.php"; $noOld = 0; $showCat="1|4|2|5|"; require ("calendar/calendar.php"); ?>
So really, I'm just wanting to swap out the "$listYear=2005" with the year picked from the dropdown -
problably dead simple php for those who know it, but I haven't a clue -
any ideas or pointers - or possible future modification of the cat filter plugin?!!

:classic:
thanks
- k

Brian
11-06-2005, 05:54 PM
Just add a regular HTML form with the year selections in a drop-down and assign it to a name like selectYear.

Then add some code to your page that says:

<?php
if (!$selectYear) $selectYear=2005;
?>

This way, it will default to 2005, but will allow selections from the form for other year(s).

neubeedoo
11-06-2005, 07:50 PM
Like I said -- dead easy if you know this stuff - this is gonna take me 2 weeks ...:crybaby:
I know this isn't the place for tutorials in the basics, so I understand if I can't get the answer here directly ...
but just incase someone has a spare moment ...
So if I have:<?php
if (!$selectYear) $selectYear=2005;
?> then how do I plug in the result into the following: <?php $LIST=1; $DF = "M d Y - l"; $listYear = "2005";
$template="events1_all1.php"; $noOld = 0; $showCat="1|4|2|5|"; require ("calendar/calendar.php"); ?>
$listYear="2005" in the above should now say what ... "$selectYear" ?? $listYear="$selectYear" ??
And how do I make the Form talk to all of this?<form name="selectYear" action=" ????" method="???? ">
<div>
<select name="selectYear">
<option value="2004">2005</option>
<option value="2005">2004</option>
</select>
</div>
<input type="submit" name="Submit" value="???">
</form>
What would be the method and action?
---
Off to google some form and php tutorials ...

- k

Brian
11-06-2005, 08:06 PM
I should have also said to change:

$listYear = "2005"; to $listYear = $selectYear;

Get or Post forms will work. You may need to chage the $selectYear variables to $_REQUEST[selectYear'] if your server has global variables disabled.

neubeedoo
11-06-2005, 09:01 PM
thanks - I'll give it a go ...