Change List view with Gallery view

How can to change List view with Gallery view into Elgg themeĀ 
How can to change List view with Gallery view into Elgg theme

Open the file

elgg\engine\lib\views.php

And change this code

if ($vars['list_type'] != 'list') {
return elgg_view('page/components/gallery', $vars);
} else {
return elgg_view('page/components/list', $vars);

With this

if ($vars['list_type'] != 'list') {
return elgg_view('page/components/gallery', $vars);
} else {
return elgg_view('page/components/gallery', $vars);

Gallery view into Elgg theme

Share on Facebook
Share on Twitter




5 Responses to “Change List view with Gallery view”

  1. pianist says:

    Easy hack …without installation many plugins

  2. elgger says:

    How to display numbers of comments and likes in gallery view?

    • pianist says:

      Step 1. Use this code

      For Comments:
      $comments_count = $ENTITY->countComments();
      if ($comments_count != 0) {
      $text = elgg_echo("comments") . " ($comments_count)";
      $comments_link = elgg_view('output/url', array(
      'href' => $ENTITY->getURL() . '#ENTITY-comments',
      'text' => $text,
      'is_trusted' => true,
      ));
      } else {
      $comments_link = '';
      }

      For Likes:
      $likes_count = $ENTITY->countAnnotations('likes');
      if ($likes_count != 0) {
      $text = elgg_echo("likes") . " ($likes_count)";
      $likes_link = elgg_view('output/url', array(
      'href' => $ENTITY->getURL() . '#ENTITY-likes',
      'text' => $text,
      'is_trusted' => true,
      ));
      } else {
      $likes_link = '';
      }

      Step 2. Replace ENTITY with your SUBTYPES (eg., file, bookmarks … e.t.c)

      Step 3. Add aboving code in the file:
      elgg\mod\ENTITY\views\default\object\ENTITY.php

      Step 4. Use this code:
      echo "<p>$comments_link $likes_link</p>";
      And add it in to GALLERY view section.

      —————
      Example for Files:

      Open the file:
      elgg\mod\file\views\default\object\file.php

      Add this code:
      $comments_count = $file->countComments();
      if ($comments_count != 0) {
      $text = elgg_echo("comments") . " ($comments_count)";
      $comments_link = elgg_view('output/url', array(
      'href' => $file->getURL() . '#file-comments',
      'text' => $text,
      'is_trusted' => true,
      ));
      } else {
      $comments_link = '';
      }

      $likes_count = $file->countAnnotations('likes');
      if ($likes_count != 0) {
      $text = elgg_echo("likes") . " ($likes_count)";
      $likes_link = elgg_view('output/url', array(
      'href' => $file->getURL() . '#file-likes',
      'text' => $text,
      'is_trusted' => true,
      ));
      } else {
      $likes_link = '';
      }

      And change this code:
      } elseif (elgg_in_context('gallery')) {
      echo '<div class="file-gallery-item">';
      echo "<h3>" . $file->title . "</h3>";
      echo elgg_view_entity_icon($file, 'medium');
      echo "<p class='subtitle'>$owner_link $date </p>";
      echo '</div>';

      With this:
      } elseif (elgg_in_context('gallery')) {
      echo '<div class="file-gallery-item">';
      echo "<h3>" . $file->title . "</h3>";
      echo elgg_view_entity_icon($file, 'medium');
      echo "<p class='subtitle'>$owner_link $date $comments_link $likes_link</p>";
      echo '</div>';

      —————

      Test it before using!
      Have a nice ElGgHaCk Day ;)

  3. suro says:

    how to delete every comments or status have made ?
    becoz,no delete button
    ellg v 1.7

Leave a Reply



Similar Elgg Hacks