Forums / Discussions / Get Chinese Articles through eZ API
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
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.
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 :
Are these fulfilled ?
To further troubleshoot, you can :
php bin/php/ezexec.php --debug=all subtree_fetch_test.php
Let us know how things go,Cheers,
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,
Wednesday 08 June 2011 1:39:46 am
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