PHP code example of nlybe / elgg-news

1. Go to this page and download the library: Download nlybe/elgg-news library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nlybe / elgg-news example snippets


echo elgg_view('elgg-news/custom_list_view', [
    'entities' => $entities,    // list of news entities, previously retrieved
    'read_more' => true,        // set true if want to add a "Read more" link for each news item
    'item_class' => '',         // set a custom class on news items, so it could be customized through CSS
    'photo_size' => 'custom',   // set the size of the news photo, see more details below
    'photo_cover' => false,     // set true if want to use the news as cover image, otherwise it will be displayed inline with title and intro
    'photo_class' => '',        // set a custom class on news photo
]);

elgg_set_config('elggnews_photo_sizes', [
    'topbar' => ['w' => 16, 'h' => 16, 'square' => true, 'upscale' => false],
    'tiny' => ['w' => 25, 'h' => 25, 'square' => true, 'upscale' => false],
    'small' => ['w' => 40, 'h' => 40, 'square' => true, 'upscale' => false],
    'medium' => ['w' => 100, 'h' => 100, 'square' => true, 'upscale' => false],
    'large' => ['w' => 200, 'h' => 200, 'square' => true, 'upscale' => false],
    'master' => ['w' => 2048, 'h' => 2048, 'square' => false, 'upscale' => false],
]);