1

I am displaying age range by using following code.

{exp:channel:entries channel="article" search:age="1-20|21-40|41-60|61-80|81-100" limit="3" dynamic="off" sort="desc"}
<ul>
    <li><a href="#">{age}</a></li>
</ul>
{/exp:channel:entries}

so according to above code i am getting following result

<a href="#">41-60</a>
<a href="#">1-20</a>
<a href="#">21-40</a>

now i want to get all article of age range ="41-60" as result when i click on range 41-60 how can i get this result ?

i am useing following sturcture for article entry enter image description here

1

I'm not sure I fully understand your question (you might want to try to clarify it a little).

{exp:channel:entries channel="article" search:age="41-60" limit="3" dynamic="off" sort="desc"}

If you need to pass the search parameter dynamically then you could use URL segments. So your url might be something like

http://mysite.com/articles/age/41-60

Then your channel entries tags would be

{exp:channel:entries channel="article" search:age="{segment_3}" limit="3" dynamic="off" sort="desc"}

You might even be able to do something like

{exp:channel:entries channel="article" search:{segment_2}="{segment_3}" limit="3" dynamic="off" sort="desc"}

You might also want to look at using a search add-on such as Super Search or Low Search as they will allow you to search on ranges rather than fixed strings. (I think EE2.7 may allow you to search ranges also).

| improve this answer | |
  • thank you for your help i also know that i have to pass URL like this mysite.com/articles/age/41-60 but for that i have to create individual template ? that way i can not use because this way is not right according to me... – Bhavin Vora Sep 23 '13 at 11:16
  • No you do not necessarily need to create a new template but we don't know what templates you have or how you have structured your site. – foamcow Sep 23 '13 at 11:20
  • hello sir i am using "article" as template_group and "age" as template now you can guide me how i can solve this problem ? – Bhavin Vora Sep 23 '13 at 12:00
  • That's fine. In that case the third segment would normally try to load an entry called 41-60. You have set dynamic="off" and you can use the third segment in your search. Have you tried my suggestion? – foamcow Sep 23 '13 at 12:12
  • yes sir i tried your suggestion but not working please check about screen shot of my entry structure. – Bhavin Vora Sep 23 '13 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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