Forums / Setup & design / Filter data in template

Filter data in template

Author Message

Siniša Šehović

Monday 03 January 2005 6:04:04 am

Hi all

I have one problem!
Don't know how to filter data in custom template by url varible.

This is what I want to do.
I have, in my template, links with letters A B C D E ... and when user klick on letter, page is reloaded. Now when the page is reloaded I need to filter fetched data with letter that user klicked.
I am getting klicked letter with

{$view_parameters.var_name}

but don't know how to filter fetch data!

Is it posslible to do that with fetch or I have to use search?

Please help!

Best regards,
S.

---
If at first you don't succeed, look in the trash for the instructions.

Lazaro Ferreira

Monday 03 January 2005 8:56:56 am

Hi,

At first, this is perfectly possible , see ez DOC about data fetching

http://ez.no/ez_publish/documentation/reference/data_fetching

How do you pretend to match data from letters in your URL, I mean this letters are related to or included in which content class attribute ?

Lazaro
http://www.mzbusiness.com

Siniša Šehović

Tuesday 04 January 2005 5:17:03 am

Hi Lazaro

Thanks for quick reply!

Letters on top of my template (page) are like menu, simple array of letters. They don't belong to any class.
I have managed to fetch data (filter data) by selecting appropriate letter.

Now I have another problem.
Is it possible to have in template something like if-then-else but on template level? I know that there is a switch but it is only for display data.

To be more cleared:
If I click on letter "A" template will fetch filtered data with attribute_filter A and if I click on "B" template will fetch filtered data with attribute_filter B!?

Something like:
if var="A" then filter_set=something
else filter_set=something_else

Best regards,
S.

---
If at first you don't succeed, look in the trash for the instructions.

Lazaro Ferreira

Tuesday 04 January 2005 7:24:46 am

Hi,

AFAIK, you can use the switch or the section-else statement, i.e:

{switch match=$view_parameters.var_name}
  {case match='A'}
     {set filter_data="Case A"}
  {/case}	
  {case match='B'}
     {set filter_data="Case B"}
  {/case}
{/switch}	

Case you need it, you can also nest the switch in a section loop, to achieve something like a php construct :

for(){
  switch(){
  }
}

Lazaro
http://www.mzbusiness.com