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

eZ debug

Timing: Jan 18 2025 16:14:15
Script start
Timing: Jan 18 2025 16:14:15
Module start 'content'
Timing: Jan 18 2025 16:14:15
Module end 'content'
Timing: Jan 18 2025 16:14:15
Script end

Main resources:

Total runtime0.0370 sec
Peak memory usage4,096.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.8203180.8438
Module start 'content' 0.00690.0124 769.664197.9766
Module end 'content' 0.01930.0176 867.640674.7031
Script end 0.0368  942.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00318.4570120.0003
Check MTime0.00133.5617120.0001
Mysql Total
Database connection0.00123.322910.0012
Mysqli_queries0.00297.809840.0007
Looping result0.00000.075520.0000
Template Total0.016745.210.0167
Template load0.00112.939010.0011
Template processing0.015642.266310.0156
Override
Cache load0.00082.154410.0008
General
dbfile0.007018.8207100.0007
String conversion0.00000.016830.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs