Displaying tags with ‘and’ ‘or’ statements
Posted: 15 July 2007 12:16 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-06-19

Hi there,

Is it possible to use the tags to display ‘or’ statements, i.e. display results for tags that equal ‘red’ or ‘blue’ ?  Or results for tags that equal ‘red’ and ‘blue’ ?

If so, do I just need to add a certain operator to the URL, or within the code itself?

If not, will tag 2.0 allow this?

Thanks,

Ste

Profile
 
 
Posted: 15 July 2007 10:50 PM   [ Ignore ]   [ # 1 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

Tag 2.0 allows for something like this, yes. The {exp:tag:entries} tag expects tags to be passed via the URL, multiple tags separated by comma. By default, a single matching tag will suffice to bring up an entry ("OR"). If you use the “inclusive” parameter, like so:

{exp:tag:entries weblog="some_weblog" inclusive="yes" orderby="entry_date" sort="asc" limit="20"}

... only entries that contain all of the tags will be shown ("AND"). I hope that answers your question.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 19 July 2007 04:27 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-06-19
Ingmar - 15 July 2007 10:50 PM

Tag 2.0 allows for something like this, yes. The {exp:tag:entries} tag expects tags to be passed via the URL, multiple tags separated by comma. By default, a single matching tag will suffice to bring up an entry ("OR"). If you use the “inclusive” parameter, like so:

{exp:tag:entries weblog="some_weblog" inclusive="yes" orderby="entry_date" sort="asc" limit="20"}


… only entries that contain all of the tags will be shown ("AND"). I hope that answers your question.

Thanks Ingmar...bring on Tag 2.0 then, I can’t wait! grin

Ste

Profile
 
 
Posted: 20 January 2008 06:52 PM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-06-19

Hi Ingmar,

Now that I’m using Tag 2.0 and I’ve just been reminded that I can use the inclusive parameter (I forgot about this thread!), I’ve just tried using it.

Unfortunately, I get the following error message when trying to access http://www.mywebsite.com/tags/blue,red

Disallowed Key Characters

Any ideas why this would be?

For info, here’s my tag code:

{exp:tag:entries weblog="gallery" inclusive="yes" marker="tags"}

Thanks,

Ste

Profile
 
 
Posted: 21 January 2008 07:44 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3272
Joined  2006-10-18

What is your default Character Set set to? smile

CP Home › Admin › System Preferences › General Configuration

 Signature 
Profile
 
 
Posted: 21 January 2008 06:52 PM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-06-19

It’s currently utf-8.

What should I change it to, or is this okay?

Thanks,

Ste smile

Profile
 
 
Posted: 22 January 2008 12:29 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

I wonder about that comma in the tags. It may be that EE 1.6.1 is prohibiting incoming urls that contain commas. PieMan, can you test that out?

mk

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 22 January 2008 02:29 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3272
Joined  2006-10-18

Works fine in both EE 1.6.1 and 1.6.0 Mitchell smile

 Signature 
Profile
 
 
Posted: 23 January 2008 10:31 AM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-06-19

I’m using version 1.6.1 (4th December build...will upgrade soon) and the MSM - this site is one of my ‘child sites.’

Any tips for anything else to try?

For info, I’m also using a comma to separate my tags.

Thanks,

Ste

Profile
 
 
Posted: 23 January 2008 11:37 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

sm9,

None of this rings any bells with me. But I do still suspect the comma in the url.

mk

 Signature 

Mitchell Kimbrough

Profile