Forums / Discussions / Get Chinese Articles through eZ API

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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 Exponential 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