I'd like to make it that only certain categories posts show up on the main site, and to restrict others to only show when the category is accessed from the menu. Is this possible through modifications or some sort of plugin?
Thanks.
Only display certain categories
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Only display certain categories
Yes, this can be done with a plugin solution.
But the easiest way is to set a fixed category for the mainpage to be displayed.
Edit your index.php and enter the line
$serendipity['GET']['category'] = '5';
Instead of 5 use the category id you want to be shown on the mainpage. Then your visitors must access the category list to view other categories.
As you can post to multiple categories, you can assign every entry for the mainpage category to (also) show up there.
Regards,
Garvin
But the easiest way is to set a fixed category for the mainpage to be displayed.
Edit your index.php and enter the line
$serendipity['GET']['category'] = '5';
Instead of 5 use the category id you want to be shown on the mainpage. Then your visitors must access the category list to view other categories.
As you can post to multiple categories, you can assign every entry for the mainpage category to (also) show up there.
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/
# 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/
-
Guest
Not Working
Hi, thank you for such a quick reply. I've been trying to get this solution to work, but I'm having a hard time.
I'm not sure where this is supposed to be added/edited, so if you could clarify that I'd really appreciate it. I've tried editing a few lines that look similar and also adding the line you mentioned but simply modifying the category number to no avail.
I'm not sure where this is supposed to be added/edited, so if you could clarify that I'd really appreciate it. I've tried editing a few lines that look similar and also adding the line you mentioned but simply modifying the category number to no avail.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Not Working
I'd need to know which Serendipity version you're running? Then I can give you more detailed instructions...
Regards,
Garvin
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/
# 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/
-
Guest
Versions
I'm using yesterdays CVS (s9y_200502061337.tar.gz) 0.8 development version. I suppose it'd be better to use the stable version though, right? I'm just used to the open source community treading very carefully with their versions, most development versions in my experience have been release quality, it just seems like developers are being careful. So far, this has been the case with the development snapshot (or so I've found, it's quite stable) as well. Kudos to you on that.
However, If it'll work better on a previous release, please direct me to which would be best.
Thanks, your help is much appreciated.
However, If it'll work better on a previous release, please direct me to which would be best.
Thanks, your help is much appreciated.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Versions
Hi!
In fact you're doing the right thing - latest CVS is always better for us to tell you about.
Now, just open your index.php file of Serendipity. Go to line 293. There you should see this line:
change that to:
You see, I inserted the 'category = 2' line. 2 is the ID of my category (I can see that by hovering over the category sidebar list and look at the URL - first digit before the "-" is always the categoryid.
Try that
Have fun,
Garvin
In fact you're doing the right thing - latest CVS is always better for us to tell you about.
Now, just open your index.php file of Serendipity. Go to line 293. There you should see this line:
Code: Select all
if ($serendipity['GET']['action'] == 'search') {
$serendipity['uriArguments'] = array(PATH_SEARCH, urlencode($serendipity['GET']['searchTerm']));
} else {
$serendipity['uriArguments'][] = PATH_ARCHIVES;
}
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
Code: Select all
if ($serendipity['GET']['action'] == 'search') {
$serendipity['uriArguments'] = array(PATH_SEARCH, urlencode($serendipity['GET']['searchTerm']));
} else {
$serendipity['uriArguments'][] = PATH_ARCHIVES;
}
$serendipity['GET']['category'] = '2';
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
Try that
Have fun,
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/
# 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/
-
Guest
Working Now
Wonderful, thank you very much for your help, it's quite appreciated! The modification is working fine, now I can get down to redesigning my journal.
Thanks again, Keep up the good work!
~chris
Thanks again, Keep up the good work!
~chris
-
borzwazie
Re: .7-beta 3
I did this in index.php:borzwazie wrote:Can you also do this with the .7 version? I can't find the line you mention anywhere in the index.php at all.
thanks!
Code: Select all
if (count($serendipity['GET']) == 2) {
if (isset($matches) && is_array($matches) && isset($matches[1])) {
$serendipity['GET']['category'] = $matches[1];
}
ob_start();
$serendipity['GET']['category'] = '6';
include_once(S9Y_INCLUDE_PATH . 'serendipity_genpage.inc.php');
-
borzwazie
got it!
I did this:
This seems to work!
Code: Select all
if (count($serendipity['GET']) == 2) {
if (isset($matches) && is_array($matches) && isset($matches[1])) {
$serendipity['GET']['category'] = $matches[1];
} else {
$serendipity['GET']['category'] = '6';
}
ob_start();