2016-10-20 2 views
1
$widget = $vars['entity'];        
    $container = $widget->getContainerEntity();       
    $options = eligo_get_display_entities_options($widget); 

이것은 내 owner_block.php 파일에서 작동하지 않는 주 회선 코드입니다. 나는 적절한 형식에서 라인 코드elgg에서 코드가 작동하지 않습니까?

elgg.2.2.1 \ 모드 \ owner_followers_counter \ 뷰 \ 기본 \ 프로필 \ owner_block.php

이 코드가 작동하지 않는 작성하는 방법을 모른다 파일 이름에 owner_block.phpowner_followers_counter 플러그인을 삽입했습니다. 이 코드를 내 owner_block.php 파일에 삽입하면 출력물이 가장 좋아하는 게시물이 표시되지만 두 줄이 제대로 작동하지 않으며 서식을 지정하는 방법을 모르겠습니다. 두 줄이 $container = $widget->getContainerEntity();

    $widget = $vars['entity'];        
       $container = $widget->getContainerEntity(); // problem here      
       $options =eligo_get_display_entities_options($widget); // and, problem is here 

       $options['annotation_names'] = array('likes'); 

       if (elgg_instanceof($container, 'user') && $widget->my_likes !== 0) { 
        $options['annotation_owner_guids'] = $container->guid; 
       } 

       if (!elgg_instanceof($container, 'user') && !elgg_instanceof($container, 'group')) { 
        unset($options['container_guids']); 
       } 


       if ($widget->eligo_sortby == 'mostliked') { 
        $dbprefix = elgg_get_config('dbprefix'); 
        $likes_metastring = get_metastring_id('likes'); 
        $options['selects'] = array("(SELECT count(distinct l.id) FROM {$dbprefix}annotations l WHERE l.name_id = $likes_metastring AND l.entity_guid = e.guid) AS likes"); 

        $options['order_by'] = 'likes ASC'; 
        if ($widget->eligo_sortby_dir == 'desc') { 
        $options['order_by'] = 'likes DESC'; 
        } 
       } 

       $content = elgg_list_entities_from_annotations($options); 
+0

에서 시작 작동하지 않습니다

내가 사용하는 3 플러그인, 1.owner_followers_counter는 2.Liked_Content는 3.au_widget, 나는 liked_content에서이 코드를 얻을에 넣어 것입니다 것 owner_block.php가 작동하지 않습니다. –

+0

fav_content 플러그인 파일에서 elgg.2.2.1 \ mod \ lik_content \ views \ default \ widgets \ liked_content \ content.php 코드를 가져와이 코드를 elgg.2.2.1에 붙여 넣으십시오. \ mod \ profile \ views \ default \ profile \ owner_block.php 일부 변경 사항 ... 지금 –

+0

위젯 컨텐츠를 비 위젯보기 파일에 표시하려고합니다. 하지만 그 절차는 잘 모르겠습니다. pls. 저를 도와주세요, 저에 관하여 약간 연장 또는 정보를 얻으십시오. 엘그에서. –

답변

1
**Ok, I Will Get Answer** 

$user = elgg_get_page_owner_entity(); 
$user_guid = $user->guid; 

$options['annotation_names'] = array('likes'); 
$options['annotation_owner_guids'] = $user_guid; 

$dbprefix = elgg_get_config('dbprefix'); 
$likes_metastring = elgg_get_metastring_id('likes'); 
$options['selects'] = array("(SELECT count(distinct l.id) FROM {$dbprefix}annotations l WHERE l.name_id = $likes_metastring AND l.entity_guid = e.guid) AS likes"); 
$options['order_by'] = 'likes DESC'; 

$content = elgg_list_entities_from_annotations($options); 
관련 문제