Page 1 of 2
How to link directly to multiple categories
Posted: Wed Feb 13, 2008 11:26 pm
by tombriggs
I currently have a domain name (
www.fullcolumnscan.com, in case it matters) that redirects to a single category within my blog. (In other words, when you visit that site, it redirects you to a listing of posts in category X on another site.) I'd like to change it to redirect to multiple categories, i.e. to show all posts in categories X, Y and Z. It seems like I should be able to construct a URL that would do that, but I can't seem to figure out what that URL should look like.
Anybody have any suggestions? Is there an easier way to do this than constructing URLs?
Thanks
-Tom
Re: How to link directly to multiple categories
Posted: Thu Feb 14, 2008 12:30 pm
by garvinhicking
Hi!
Yes, you can use multiple category-IDs like:
index.php?serendipity[category]=1;3;5
HTH,
Garvin
Posted: Thu Feb 14, 2008 3:12 pm
by tombriggs
That's perfect, thanks much!
Posted: Mon Feb 25, 2008 12:12 pm
by ormus7577
Any reason why this doesn't work on my installation? See
http://familie.lobenstein.info/ in the navbar ('Liste aller Beiträge'). The template can list multiple categories when selected via the sidebar plugin...
Posted: Mon Feb 25, 2008 12:15 pm
by garvinhicking
Hi!
I do think it's related to your template, because even
http://familie.lobenstein.info/index.ph ... ategory]=2
does not show category #2 for you.
Might also be a matter of the event plugins you're using?
Regards,
Garvin
Posted: Mon Feb 25, 2008 10:30 pm
by ormus7577
I just checked it, it IS the template... I've switched to my previous template and the link works there (see for yourself, i still got it online). Any idea how a template could do this? Or is there any other way to link categories?
Posted: Tue Feb 26, 2008 11:02 am
by garvinhicking
Hi!
You might want to ask the theme porter yellowled about this; I haven't had the chance to test his template. It might be related to the way he uses $view checks.
Regards,
Garvin
Posted: Tue Feb 26, 2008 4:05 pm
by Don Chambers
A page using multiple categories has $view equal to "start". That should probably be either "categories" or a new, unique value, such as multicategories.
Currently available values of $view:
Indicates the current "view" on the frontend. One of: "archives, entry, feed, admin, archives, plugin, categories, authors, search, css, start, 404"
Scope: *.tpl
@ Garvin - there is a typo in there.. archive
S is listed twice, but "older" archives are "archive".
@YL - The full definition of which pages get $view=="start" is not listed, but in my own quick test I noticed the base page, contact form, static pages and possibly plugin pages like my download manager all get that value for $view.
You might want to use the BP method for $currpage in config.inc.php:
Code: Select all
$serendipity['smarty']->assign(array('currpage'=> "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']));
and this for detecting the start page (which could also be flawed for all I know):
Code: Select all
{if $currpage==$serendipityBaseURL}
@ Garvin again - is there a better way to detect the front/base/start/home domain page than what I just listed?
Posted: Tue Feb 26, 2008 4:17 pm
by yellowled
Don Chambers wrote:@YL - The full definition of which pages get "start" is not listed, but in my own quick test I noticed the base page, contact form, static pages and possibly plugin pages like my download manager all get that value for $view.
I'm a little swamped currently, but I'll test it asap. Until then, I'm leaning back to see what Garvin has to say
YL
Posted: Tue Feb 26, 2008 8:52 pm
by ormus7577
Ok, I've found a workaround. Pretty ugly one... I've added a form with hidden values to the html and use a javascript calling href in the navbar to submit it. See
http://familie.lobenstein.info/
I know, that's pretty bad as it requires javascript for something as simple as a link...
Posted: Wed Feb 27, 2008 6:33 am
by yellowled
Don Chambers wrote:You might want to use the BP method for $currpage in config.inc.php:
Code: Select all
$serendipity['smarty']->assign(array('currpage'=> "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']));
and this for detecting the start page (which could also be flawed for all I know):
Code: Select all
{if $currpage==$serendipityBaseURL}
@ Garvin again - is there a better way to detect the front/base/start/home domain page than what I just listed?
Can't say I fully understand it, but it works, at least for detecting single entry, static page, or start page. 404 pages apparently still need $view == 404, but that's not an issues.
If Garvin doesn't veto this or come up with something even better, we could update the mimbo in spartacus asap.
YL
Posted: Wed Feb 27, 2008 6:57 am
by Don Chambers
yellowled wrote:Can't say I fully understand it, but it works, at least for detecting single entry, static page, or start page. 404 pages apparently still need $view == 404, but that's not an issues.
If Garvin doesn't veto this or come up with something even better, we could update the mimbo in spartacus asap.
YL
I understand it, but I just wanted input from those who know a lot more than I. There might, or might not, be a better way to detect the front page. I am successfully using the code I gave you with static pages, regular pages, and a variety of plugins. I just do not know if this is the best possible method, especially with URL rewriting and a few other scenarios I can think of. Just trying to help.

And what is with this "we could update spartacus..." That's your problem!!!

Posted: Wed Feb 27, 2008 9:58 am
by garvinhicking
Hi!
Don: Thank you, the "archives" vs. "archive" thing is now fixed in the wiki.www.
As for the 'start' view: Actually, when you call index.php?serendipity[GET][category] immediately, it really IS the start view. Inside the template you might want to check if $category_info is set to detect if a fixed category is used. The category view is really only applied if a category view permalink is used, I'm afraid.
Best regards,
Garvin
Posted: Wed Feb 27, 2008 10:55 am
by ormus7577
I love this forum

Garvin, your message gave me a new idea how to link all/multiple categories in the Mimbo template. I just use a dummy parent category containing all 'real' categories. Now I can just link to this category permalink and all entries of subcategories will be listed
As an added benefit: when linking to multiple categories the page title will always contain just one (I guess the first found) category title. With the the parent category I can set that title to like 'all entries'... Plus the categories sidebar plugin is versatile enough to hide that parent category!
Posted: Wed Feb 27, 2008 12:58 pm
by yellowled
garvinhicking wrote:Inside the template you might want to check if $category_info is set to detect if a fixed category is used. The category view is really only applied if a category view permalink is used, I'm afraid.
I'm sorry, but how/where should I check this? If I add a <p>{$category_info}</p> to index.tpl, the output is "Array", if that's of any help.
YL