API Questions

Author Message

Matt McLaughlin

Monday 31 August 2009 6:50:00 pm

My company is looking for a CMS tool we can use to manage multiple languages for our content. What attracted us to eZ is the possibility of using the API. We use a cake framework to power the rest of our site and would like to use the API to import content in the correct language. Does this sound like something the eZ publish API is capable of doing? I'm looking through the API Docs but I'm not finding a good jumping off point.

Any help would be appreciated, thanks!

Lazaro Ferreira

Tuesday 01 September 2009 1:33:41 am

Hi,

You can import your content into ezpublish from csv files running

bin/php/ezcsvimport.php

 

from command line,

if you need to do it your way, you can look at this script code, to see how ezpublish content attribute API is used to import , i.e:

$attribute->fromString( $dataString );

Also there are some contributions at projects.ez.no, that implement more avanced import funcionalities

Regards

Lazaro
http://www.mzbusiness.com

Matt McLaughlin

Tuesday 01 September 2009 10:13:07 am

Well, it wasn't getting the content into eZ Publish, it was getting it out of. What we're looking to do is have eZ Publish manage our content and it's various languages then use cakephp as the view layer via the API.

However this might be useful with some of our existing content.

Matt McLaughlin

Tuesday 08 September 2009 2:09:08 pm

Any information at all would be helpful. To describe what we're doing again is trying to use eZ Publish to manage our versions, translations, and management of our content but would like to use the API to extract the content in our own pre-existing system/templating engine.

I see you can write cli scripts is there something similar but for the web side of things?

Gaetano Giunta

Wednesday 09 September 2009 1:04:31 am

I'm afraid there is no real explicit (documented) support for doing what you want.

It is technically possible, of course, but the whole 'framework' is designed the other way round: it is easier to extended by including/wrapping 3rd party code rather than by including it.

Some points that have to be taken care of:
- the autoload system used as php class loader is a little piece of code that has grown already complex because it caters to both eZPublish and eZComponents classes
- using any php class of eZPublish means bootstrapping at least the configuration system - which will in turn load the debug system (both quite heavy)
- you always need to define a 'siteaccess' to be used while you are operating
- everything works best if started from the eZPublish root dir. It might not work otherwise

The best way to gain enough knowledge about how to embed eZP within another script is to look at the existing controller code, and then try and experiment writing your own minimal bootstrapping code that can be safely included within an external app:
- index.php
- soap.php
- the ezcli and ezscript classes, used by all command line scripts

Principal Consultant International Business
Member of the Community Project Board

Gaetano Giunta

Wednesday 09 September 2009 1:08:48 am

PS: if what you want is not "live" integration, there are a thousand possibilities for exporting content / content-views from eZPublish and import them in your application:
- eZPublish packages (created via admin interface)
- export scripts (look at exportcsv as an example)
- rss feeds (managed via admin interface)
- xml/json templates of content (look at the ggxmlview extension)
- webservice calls (native soap controller or a lot of extensions, from ezrest to ggwebservices to ezcore)

Principal Consultant International Business
Member of the Community Project Board

Matt McLaughlin

Wednesday 09 September 2009 10:24:01 am

I wish we could just do it all in ez Publish, haha, but we have templates for our forum in vBulliten, and our main sites in cakephp. No matter which way we go from here, it's going to be a lot of work.

I am successful in extracting data via a web script, the only issue now is breaking it out from the ezpublish folder itself. This may not be entirely possible, but, with some routing rules we may be able to fake it enough ;)

Thank you for your fast response. I realize this is NOT how ez Publish intended it's framework to operate, lol, but it will actually make our site much easier to maintain.

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