2

is there an easy way to show two EE categories in a list? let's say i have agenda/C3 and agenda/C9

can i combine this to agenda/C3&C9 (this obviously doesn't work)

(my problem: the C3 is a default category and should always be showed, even if you select another category)

cheers, dave

1
  • 3
    Are you trying to list the entires for those categories or the categories themselves? Include your tag code for the one category so we can answer more specifically. Also are you attempting to get the category by it's label or do you know it's ID? Commented Aug 28, 2013 at 8:06

3 Answers 3

2

I just read the answer you posted answer and you don't need PHP to do this.

In the template where you have your {exp:channel:categories} tag, change how the category URL is created so it just passes the category ID...

<a href="{path=agenda}"> becomes <a href="/agenda/{category_id}">.

This will give you a URL that looks like /agenda/9.

Then in your channel:entries tag you use category="9|{segment_2}".

4

Have you tried category="" in your channel?

{exp:channel:entries channel="{channels}" category="3|9" dynamic="yes"  }

http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#category

You could also try low seg2cat http://gotolow.com/addons/low-seg2cat/docs

...where n is the segment number. {segment_category_ids} will return an inclusive stack of all found category ids, for example: 4&12. {segment_category_ids_piped} will return an exclusive list: 4|12.

0

this is how i solved it

separate category template starting with

<?php
$uri = $_SERVER['REQUEST_URI'];
$pieces = explode("/", $uri);
$lastsegment = $pieces[4];
$catid = substr($lastsegment, 1);
?>

and then the tag

{exp:channel:entries channel="agenda" status="open" limit="50" category="9|<?php echo $catid ?>" orderby="entry_date" sort="asc" start_on="{current_time format='%Y-%m-%d 00:00'}" show_future_entries="yes"}

and php enabled on input, 9 is the category id that has to be showed by default

1
  • 1
    You're making this more complicated than it needs to be and you don't need PHP to accomplish this... see the answer I posted.
    – Anna_MediaGirl
    Commented Aug 28, 2013 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.