Specifications
Viewing Lists
We will implement a number of options for viewing available lists and list details. In Figure
28.6, you can see two of these options: Show My Lists, which will retrieve the lists this user is
subscribed to, and Show Other Lists, which will retrieve the lists the user is not subscribed to.
If you look back at Figure 28.4, you will see that we have another option, Show All Lists,
which will retrieve all the available mailing lists on the system. For the system to be truly scal-
able, we should add paging functionality (to display, say, 10 results per page). We have not
done this here for brevity.
These three menu options activate the
show-my-lists, show-other-lists, and show-all-lists
actions, respectively. As you have probably realized, all these actions work quite similarly. The
code for these three actions is as follows:
case ‘show-all-lists’ :
{
display_items(“All Lists”, get_all_lists(), ‘information’,
‘show-archive’,’’);
break;
}
case ‘show-other-lists’ :
{
display_items(“Unsubscribed Lists”,
get_unsubscribed_lists(get_email()), ‘information’,
‘show-archive’, ‘subscribe’);
break;
}
case ‘’:
case ‘show-my-lists’ :
{
display_items(“Subscribed Lists”, get_subscribed_lists(get_email()),
‘information’, ‘show-archive’, ‘unsubscribe’);
break;
}
As you can see, all these actions call the display_items() function from the output_fns.php
library, but they each call it with different parameters. They all also use the get_email()
function we mentioned earlier to get the appropriate email address for this user.
To see what this function does, look at Figure 28.7.
Building a Mailing List Manager
C
HAPTER 28
28
BUILDING A
MAILING LIST
MANAGER
679
34 7842 CH28 3/6/01 3:46 PM Page 679