How to link directly to multiple categories

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
tombriggs
Regular
Posts: 24
Joined: Thu Aug 09, 2007 3:54 pm

How to link directly to multiple categories

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: How to link directly to multiple categories

Post by garvinhicking »

Hi!

Yes, you can use multiple category-IDs like:

index.php?serendipity[category]=1;3;5

HTH,
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/
tombriggs
Regular
Posts: 24
Joined: Thu Aug 09, 2007 3:54 pm

Post by tombriggs »

That's perfect, thanks much!
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post 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...
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# 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/
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post 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?
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# 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/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.. archiveS 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?
Last edited by Don Chambers on Tue Feb 26, 2008 4:41 pm, edited 1 time in total.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post 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...
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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. :D And what is with this "we could update spartacus..." That's your problem!!! :lol: :lol: :lol: :lol:
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# 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/
ormus7577
Regular
Posts: 122
Joined: Sat Nov 04, 2006 12:11 pm
Location: Ulm, Germany

Post 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 :D

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!
my installations:
family blog: http://familie.lobenstein.info/
personal blog: http://www.ormus.info/
OrmusTool Homepage: http://tool.ormus.info/
Online Adventskalender: http://www.ormus.info/pages/advent.html
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
Post Reply