2015-01-26 3 views
2

PHP를 사용하여 콘텐츠를 가져 오려고합니다. 하지만 내 코드가 작동하지 않는 것 같습니다. 나는 ezcontentobjecttreenode::subtree 기능을 사용하고 있지만,이 오류를 표시합니다eZ 게시 PHP로 콘텐츠 가져 오기

Using $this when not in object context in /home/quejadore/site/kernel/classes/ezcontentobjecttreenode.php on line 2032 

가 여기 내 코드입니다.

$params = $nodes =& eZContentObjectTreeNode::subTree(array( 
    'Depth' => 3, 
    'SortBy' => array('published', false), 
    'Limit' => 3, 
    'ClassFilterType' => 'include', 
    'ClassFilterArray' => array('article_v3'), 
    'Attribute_filter' => array(array('article_v3/on_newsletter', '=',true)))); 

$nodes =& eZContentObjectTreeNode::subTree($params, 21312); 

누구든지 도와 드릴 수 있습니까? ,

$params = array('Depth' => 3, 
      'Limit' =>1, 
      'IgnoreVisibility' => true, 
      'Limitation' => array(), 
      'ClassFilterType' => 'include', 
      'ClassFilterArray' => array('article_v3'), 
      'AttributeFilter' => array(array('article_v3/on_newsletter','=',true))); 


$obj = new eZContentObjectTreeNode; 
$nodes = $obj->subTree($params, 21312); 
$dataMap =$nodes->attribute('data_map'); 
$image =& $dataMap['image']->content(); 
$list =& $image->aliasList(); 
var_dump($list['original']['url']); 
+0

에 당신은 정적 메소드를 호출하고, 그것은 정적 방법이 아니다 ... 당신은 foo는 = 새로운 EzWhatever을 eztree 객체를 인스턴스화하고 $ 방법이 제대로'호출 할 필요가; $ foo-> subtree (...)' –

+0

고맙습니다. 고맙습니다. Marc. 작동하는 것 같습니다.하지만 배열은 NULL입니다. 그리고 매개 변수가 적어도 50 개의 객체를 만족시킬 것이라고 확신합니다 : | – You

+0

'Attribute_filter'가 아닌'AttributeFilter'를 시도하십시오. – foobar

답변

0

당신이 PHP에서 함수를 가져 오기 사용하는 방법을 알고해야하는 경우 사전

에 고맙습니다 이제라도 좋습니다 내가 지금 가지고있는 것입니다 (여전히 아직 작동하지 않는 경우에도) 내 코드를 편집 한 https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/tree

는 '분류'버전 매개 변수를 대체합니다 : 귀하의 경우, 함수 참조를 가져 오기 템플릿을 살펴 가지고 레즈가 게시 기억 가시성을 담당 ... attribute_filterAttributeFilter이되고, class_filter_typeClassFilterArray되고, 등 및 역할 권한 PHP API를 사용합니다. 이를 무시하려면 매개 변수 배열에 'IgnoreVisibility' => true을 사용하십시오.

또한, 나는 당신이 뭘 하려는지 모르겠어요하지만 당신은

0

& 그래서 내가 solution.Here의 내 코드 발견하여 참조로이 메소드를 호출 할 필요가 없습니다 :

$params = array(
      'Depth' => 3, 
      'AsObject' => true, 
      'Limit' =>3, 
      'SortBy' => array('published', false), 
      'IgnoreVisibility' => true, 
      'Limitation' => array(), 
      'ClassFilterType' => 'include', 
      'ClassFilterArray' => array('article_v3'), 
      'AttributeFilter' => array(array('article_v3/on_newsletter', '=', true))); 

$nodes = eZContentObjectTreeNode::subTreeByNodeID($params, 21312); 

고맙습니다 모든