print blogs based on categories selected

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
sweety
Regular
Posts: 42
Joined: Tue Jul 05, 2005 11:05 am

print blogs based on categories selected

Post by sweety »

hi all,
i added a new functionality wherein if i select few categories and say ok then blogs under those categories only will be shown in the index page at that time..i have done this by adding checkboxes near the category list in category.inc.php file....i wrote the code in such a way that once i check the boxes and press ok button the category names will be stored in the database to that particular user......and again in index page i am able to print the blogs by retrieving those categories and the userid from the database....everything is working fine...but the checkboxes are not remaining as checked..i want this to happen so that when the user logins again he can see what are the categories he previously selected....
can anyone help me in doing this??? :(

Thanking you in advance..
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: print blogs based on categories selected

Post by garvinhicking »

Serendipity 0.9 also contains code to view/select multiple categories.

Just set a cookie for the categories that are selected (or store it in the DB as you said) and write a plugin that restores these values in the frontend_configure hook. Then, for serendipity 0.9, just set the appropriate values:

Code: Select all

$serendipity['POST']['isMultiCat'] = true;
$serendipity['POST']['multiCat'] = array (1, 13, 27);
The array is the imploded to $serendipity['GET']['category'] and separated by ";".

Then you can, when you output the categories, just check the categories that are inside that POST-array.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply