Third party PHP classes integration with eZ

Author Message

Ricardo Sanchez

Tuesday 30 October 2007 2:10:12 am

Hi,

I've got a few PHP files containing classes and code that I've using in other web applications. Those classes are used to create objects with atributes (like an Event with dates, places, latitude and longitude coordinates, ...), and to store those atributes in a custom database table.

Also, there are others clases in order to modify, validate and view the content of those objects.

Is any way to reuse those classes in eZ without rewrite it completely? I've reading and in http://www.sitepoint.com/article/phps-killer-app-parts-1-3 explains how to do it, but It seems to be with a 2.x version of eZ.

I would prefer to use those classes instead to setup the classes in the admin zone of an eZ Publish web because I've got to export these functionalities to another PHP system not based in eZ.

Thanks in advance,

Knut Urdalen

Tuesday 30 October 2007 3:50:26 am

The best way to do it is to create modules for all the parts you want to integrate in your custom extension. There you can do whatever you want with PHP and set template variables to use with your custom templates.

Actually the eZ Publish kernel is built on modules. The best way to learn is to read the source (kernel/*).

Some references:
- http://ezpedia.org/wiki/en/ez/developers#eztoc346_6
- http://ezpedia.org/wiki/en/ez/module
- http://ez.no/ezpublish/documentation/development/extensions/module/module_tutorial_part_1
- http://ez.no/ezpublish/documentation/development/extensions/building_an_ez_publish_module

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

Main resources:

Total runtime1.5412 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.0469152.6406
Module start 'layout' 0.00460.0031 740.687539.4766
Module start 'content' 0.00771.5319 780.1641493.1094
Module end 'content' 1.53960.0016 1,273.27348.2813
Script end 1.5412  1,281.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2037160.0002
Check MTime0.00130.0814160.0001
Mysql Total
Database connection0.00080.053610.0008
Mysqli_queries1.498597.2284540.0278
Looping result0.00050.0346520.0000
Template Total1.512498.120.7562
Template load0.00220.141120.0011
Template processing1.510297.984620.7551
Template load and register function0.00020.010710.0002
states
state_id_array0.00070.044310.0007
state_identifier_array0.00080.052020.0004
Override
Cache load0.00180.1159180.0001
Sytem overhead
Fetch class attribute can translate value0.00070.042620.0003
Fetch class attribute name0.00120.080530.0004
XML
Image XML parsing0.00070.047220.0004
class_abstraction
Instantiating content class attribute0.00000.000430.0000
General
dbfile0.00090.0588160.0001
String conversion0.00000.000740.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs