Forums / Discussions / Get Chinese Articles through eZ API

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

eZ debug

Timing: Jan 29 2025 13:31:58
Script start
Timing: Jan 29 2025 13:31:58
Module start 'content'
Timing: Jan 29 2025 13:31:58
Module end 'content'
Timing: Jan 29 2025 13:31:58
Script end

Main resources:

Total runtime0.1365 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 587.9531180.8359
Module start 'content' 0.00560.0052 768.7891102.6172
Module end 'content' 0.01080.1256 871.4063530.1563
Script end 0.1364  1,401.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.3767200.0002
Check MTime0.00130.9489200.0001
Mysql Total
Database connection0.00060.462110.0006
Mysqli_queries0.090466.25621410.0006
Looping result0.00110.80031390.0000
Template Total0.125391.810.1253
Template load0.00080.581610.0008
Template processing0.124591.229210.1245
Override
Cache load0.00060.411710.0006
Sytem overhead
Fetch class attribute can translate value0.00050.397010.0005
XML
Image XML parsing0.00030.193310.0003
General
dbfile0.00735.3322200.0004
String conversion0.00000.004430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs