Get Chinese Articles through eZ API

Author Message

Jitesh Rana

Tuesday 07 June 2011 1:54:44 am

Hello,

I could not be able to get chienese translation set Articles through eZ API.

I am using following API.

$nodes =& eZContentObjectTreeNode::subTreeByNodeID( $params, array(13611));
echo sizeof($nodes); //returns 0 count.

Urgent help needed.

Thanks & Regards,

Jitesh

Nicolas Pastorino

Tuesday 07 June 2011 2:36:13 am

Hi Jitesh,

First off, you should remove the '&' after the '=' sign. Unless you still are using PHP4, which would be surprising. Secondly, it seems like the 'eZContentObjectTreeNode::subTreeByNodeID' method is a scalar value, not an array (more on this here : http://pubsvn.ez.no/phpdoc/trunk/html/kernel/eZContentObjectTreeNode.html#subTreeByNodeID ).

The third & fourth checks are functional ones : did you make sure that the $params variable does not contain too restrictive filters, and that there actually is content under node #13611 ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Jitesh Rana

Tuesday 07 June 2011 4:01:47 am

Hi Nicolas,

Thanks for your quick reply.

I have changed according your suggestions. but still it could not be able to get articles which translation set as chienese.

Below is my Code.

$params = array('Depth' => 1, 
                  'Language' => array('chi-CN'), 
                  'ClassFilterType' => 'include', 
                  'ClassFilterArray' => array('article')); 

$nodes = eZContentObjectTreeNode::subTreeByNodeID( $params, array(13611));
echo sizeof($nodes); //returns 0 count.  

Pls. let me know if anything wrong.

Jitesh.

Nicolas Pastorino

Tuesday 07 June 2011 5:22:19 am

Hi again Jitesh,

The code looks ok. The pre-requisites for having anything returned when calling this are : 

  1. Have 'article' objects created at the first level under node having ID 13611
  2. Have these objects translated to Chinese.

Are these fulfilled ?

To further troubleshoot, you can : 

  1. write the snippet above in a separate PHP file, at the root of your eZ Publish instance. Let us call it subtree_fetch_test.php
  2. run this file using the following command, which will give you debug output atop : 
php bin/php/ezexec.php --debug=all subtree_fetch_test.php

Let us know how things go,
Cheers, 

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Jitesh Rana

Tuesday 07 June 2011 10:49:11 pm

Hello Nicolas,

I found the issue why the chinese translated article are not coming while using the eZ API.

I don't know exactly, but, May be Issue was related to configuration. I run the same code on another instance and it works perfectly.

Thanks Nicolas,

Jitesh

Nicolas Pastorino

Wednesday 08 June 2011 1:39:46 am

Hi Jitesh, 

You may want to make sure to have the 'chi-CN' language made available in the siteaccess you are running this code in. Example, from your siteaccess' site.ini.append.php override : 

[RegionalSettings]
Locale=eng-GB
ContentObjectLocale=eng-GB
SiteLanguageList[]=eng-GB
SiteLanguageList[]=chi-CN
TextTranslation=enabled

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

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

Main resources:

Total runtime0.7724 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.0156152.6250
Module start 'layout' 0.00480.0027 740.640639.4531
Module start 'content' 0.00750.7635 780.0938582.0781
Module end 'content' 0.77100.0014 1,362.171916.7813
Script end 0.7724  1,378.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4324160.0002
Check MTime0.00140.1816160.0001
Mysql Total
Database connection0.00050.065910.0005
Mysqli_queries0.706891.5119670.0105
Looping result0.00060.0792650.0000
Template Total0.741296.020.3706
Template load0.00200.264920.0010
Template processing0.739295.695920.3696
Template load and register function0.00010.017210.0001
states
state_id_array0.00080.100210.0008
state_identifier_array0.00120.153420.0006
Override
Cache load0.00180.2380530.0000
Sytem overhead
Fetch class attribute can translate value0.00100.124920.0005
Fetch class attribute name0.00230.295270.0003
XML
Image XML parsing0.00070.086620.0003
class_abstraction
Instantiating content class attribute0.00000.003190.0000
General
dbfile0.00080.1034160.0000
String conversion0.00000.001240.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
2content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
2content/datatype/view/ezxmltags/ol.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ol.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: 33
 Number of unique templates used: 10

Time used to render debug report: 0.0002 secs