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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:13:25
Script start
Timing: Jan 18 2025 19:13:25
Module start 'layout'
Timing: Jan 18 2025 19:13:25
Module start 'content'
Timing: Jan 18 2025 19:13:26
Module end 'content'
Timing: Jan 18 2025 19:13:26
Script end

Main resources:

Total runtime0.9821 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 594.4766152.6250
Module start 'layout' 0.00580.0036 747.101639.4453
Module start 'content' 0.00950.9710 786.5469555.8750
Module end 'content' 0.98050.0016 1,342.421912.7969
Script end 0.9820  1,355.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3745160.0002
Check MTime0.00150.1577160.0001
Mysql Total
Database connection0.00090.090410.0009
Mysqli_queries0.921193.7908600.0154
Looping result0.00060.0644580.0000
Template Total0.944496.220.4722
Template load0.00220.225920.0011
Template processing0.942295.940820.4711
Template load and register function0.00010.012110.0001
states
state_id_array0.00130.131310.0013
state_identifier_array0.00210.215420.0011
Override
Cache load0.00190.1890420.0000
Sytem overhead
Fetch class attribute can translate value0.00070.075220.0004
Fetch class attribute name0.00140.138150.0003
XML
Image XML parsing0.00070.072320.0004
class_abstraction
Instantiating content class attribute0.00000.001360.0000
General
dbfile0.00090.0952150.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 33
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs