fetch records from specific table in templates

Author Message

Dhaval Patel

Friday 14 December 2007 5:03:57 am

hi all

i have created one table.

i want to fetch all the records from that table in templates.

so can u tell me how to execute the query in templated and fetch data from table?

like in php

$result = $db->arrayQuery($query);

i want that type of result in template.

thank you very much for replying.

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

Laurent BOURREL

Friday 14 December 2007 6:27:12 am

Hi,
I think you will have to use your own template operator... and so, make your request in the php code, not directly in the template.

Gaetano Giunta

Saturday 15 December 2007 5:38:49 am

You can also take a look at the ezpersistentobject class.

If you map your table into a persistent object subclass, then you can use standard functionality tro have all table data retrieved and nicely wrapped in php (template) objects, too, via $array = eZPersistentObject::fetchObjectList( myPersistentObject::definition(), ...)

You can then use that array inside php code in a custom view, or create a custom operator to fetch it.

Principal Consultant International Business
Member of the Community Project Board

Dhaval Patel

Monday 17 December 2007 9:17:27 pm

hi,

thank you very much.

i have created template operator and i got result.

but now i want make one search template.

and serach action in php file.

i made that but i want to send the result from php file to template file.

i have created one topic for this.

please send me reply.

thank you again

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

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 16:16:39
Script start
Timing: Jan 18 2025 16:16:39
Module start 'layout'
Timing: Jan 18 2025 16:16:39
Module start 'content'
Timing: Jan 18 2025 16:16:39
Module end 'content'
Timing: Jan 18 2025 16:16:39
Script end

Main resources:

Total runtime0.7301 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.0469152.6406
Module start 'layout' 0.00590.0028 740.687539.4766
Module start 'content' 0.00870.7201 780.1641575.3828
Module end 'content' 0.72880.0013 1,355.546912.1250
Script end 0.7301  1,367.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4472160.0002
Check MTime0.00130.1724160.0001
Mysql Total
Database connection0.00080.105710.0008
Mysqli_queries0.679693.0812620.0110
Looping result0.00060.0772600.0000
Template Total0.702796.220.3513
Template load0.00210.287220.0010
Template processing0.700695.958620.3503
Template load and register function0.00020.022710.0002
states
state_id_array0.00080.109610.0008
state_identifier_array0.00100.135120.0005
Override
Cache load0.00170.2339290.0001
Sytem overhead
Fetch class attribute can translate value0.00060.085630.0002
Fetch class attribute name0.00120.164350.0002
XML
Image XML parsing0.00090.117830.0003
class_abstraction
Instantiating content class attribute0.00000.001750.0000
General
dbfile0.00090.1238160.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs