Example of add file or image node via API

Author Message

Christophe Saint-Pierre

Thursday 13 November 2008 7:46:09 am

Hi ,
I search for examples of codes for create nodes of File class or Image class
passing the filename in parameter.
Does anyone has some working example on version 4.0.1.

Thanks.

Piotrek Karaƛ

Tuesday 18 November 2008 8:34:19 pm

I don't have a solution, but can give you a hint:

1) Find a tutorial on how to create objects with eZ API in general. That's a must.
2) Learn a bit about how datatypes are created.
3) Each content object attribute of different datatype may have its own way of storing data, and File datatype will most likely do. List your file class attributes, and for each one, go to /kernel/classes/datatyles/* and learn how it fetches/stores data, and use that API.
4) Don't forget to publish the newly created object/node.

Hope this helps (a little bit) ;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

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 31 2025 01:17:18
Script start
Timing: Jan 31 2025 01:17:18
Module start 'layout'
Timing: Jan 31 2025 01:17:18
Module start 'content'
Timing: Jan 31 2025 01:17:19
Module end 'content'
Timing: Jan 31 2025 01:17:19
Script end

Main resources:

Total runtime1.2263 sec
Peak memory usage8,192.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.2656151.2266
Module start 'layout' 0.00460.0042 739.4922220.7188
Module start 'content' 0.00881.2167 960.21094,430.1719
Module end 'content' 1.22540.0009 5,390.38287.8125
Script end 1.2263  5,398.1953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2701160.0002
Check MTime0.00120.0985160.0001
Mysql Total
Database connection0.00060.049010.0006
Mysqli_queries1.145593.4060540.0212
Looping result0.00060.0454520.0000
Template Total1.175395.820.5876
Template load0.00220.181020.0011
Template processing1.173095.651920.5865
Template load and register function0.00160.131310.0016
states
state_id_array0.00200.164810.0020
state_identifier_array0.00170.138620.0008
Override
Cache load0.00180.1497160.0001
Sytem overhead
Fetch class attribute can translate value0.00190.151320.0009
Fetch class attribute name0.00240.193330.0008
XML
Image XML parsing0.00080.067020.0004
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00200.1613170.0001
String conversion0.00000.000640.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
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs