Custom Index and Latest Pages

Hi, All :)

I have a question about custom_index. Ive used the code from the example custom_index plugin and it works perfect to show latest blogs, files etc... but I have to add latest pages.

so we're using this code to show blogs:

    echo elgg_view_module('featured',  elgg_echo("custom:blogs"), $vars['blogs'], $mod_params);

but with the print_r($vars) and some other tests I found that same code wont work to show pages,  I need to add pages same way like they're in the profile page, if you'll add pages widget to the profile of course. So I went to the mod/pages/views/default/widgets/pages/content.php and grab some code from there, this is it with the little modifications:

$options = array(
    'type' => 'object',
    'subtype' => 'page_top',
    'limit' => 4,//$num,
    'full_view' => FALSE,
    'pagination' => FALSE,
);
$content = elgg_list_entities($options);
echo elgg_view_module('featured',  elgg_echo("custom:pages"), $content, $mod_params);

It shows me pages, but it different from the look that I have on profile page, it adds some admin links into each page (text links: public, history, edit and graphic buttons: rate, delete), like its look when you go to the "pages" page. I believe that this is something in the $options, but I don't understand why this code have different look on profile page and on my custom_index page.

Maybe somebody can help me with this?

Thanks in advance!!! :)

  • $options = array(
        'type' => 'object',
        'subtype' => 'page_top',
        'container_guid' => $vars['entity']->owner_guid,
        'limit' => $num,
        'full_view' => FALSE,
        'pagination' => FALSE,
    );
    $content = elgg_list_entities($options);
    echo $content;

  • thank you for the answer, DhrupDeScoop!

    but this doesn't fix my problem, at first of course I got the full code from the file I mention in the first message, then played a lot with this - deleted owner and changed $num to 4, but whith this or without it shows

    (text links: public, history, edit and graphic buttons: rate, delete)

    over each page anyway, but I need to show it just like its look on the profile page, the same, but without these links and buttons, so it will look like blogs, bookmarks and other stuff in the custom_index. Maybe there're some other strings which I can add to $options?

  • add elgg_push_context('widgets'); before and elgg_pop_context(); after your code

  • Ismayil Khayredinov, thank you, thank you, thank you!!!!!

    it works perfect now!!

    Thank you! :)

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking