Custom index v1.0

Release Notes

Since the question on how exactly to make a custom front page popped up quite often now, here's the code I have made for my own install. You'll still have to modify it a bit.

  • If you don't want to attach your own scripts and/or styles to the head then delete these two lines in start.php:
  • In index.php edit the last line to what you want your titel to be (up in the browser bar)
  • Edit all files in views/default/customindex:
    • content.php will be the content of your page
    • metatags.php will be the extra scripts you want to put in the head
    • css.php are all the extra styles you want to apply
  • There are a lot more things you can do, like setting a page title or changing the layout from one column to two columns, but that's up to you. These files are basically what I am using on my site, not including the scripts and styles.

Let me know if there are any problems!

  • This plugin (in conjunction with custom dashboard is great!  While this question is probably more relevant to CustomDashboard, I'll put it here as this is where the discussion is:

    When making a custom dashboard, how do I hard-code widgets into the page?  (i.e. the "your friends" widget, so that there's a mix of custom content but also dynamic content based on the user)  Any thoughts? (or, has this been discussed somewhere in here that I can't search and find?

  • Ro

    After all of this discussion and edits, has a new version been posted?

  • customindex is a misconfigured plugin.

    Hi can anyone help me i get the following error can anyone help me? thanks

  • Ro

    Is it possible to have a real mod written for this?

  • Ro

    I mean, with all of the edits and enhancements, it should have another release and be a full-fledged mod.

  • Well, this is a real mod. The only place that actually needs to be configured is content.php and I'm not planning on stuffing that full with code as everybody wants a different index page, which is after all the whole point of this plugin.

  • what about creating a group where eyeryone coan share its content.php contents. to help out me and others who aren´t the best coders?

    here it´s getting more confusing with every new comment. so far i added my differetn layout to my pages, but i had to use tables :-( i need more knowledge ....

  • Ro

    This is what I am talking about.  There are too many comments and discussion to understand the mod.

  • I've started a group called "Collaborative Coding" and setup a page and a discussion just for this plugin. Please read the description of the group and post accordingly. In other words, don't fill it up with feature requests. But if you have code to share, that would be one place to do it so long as you are willing to explain why you made the decisions you did. The group is meant to teach people how to code in Elgg.

  • Chiinook, good idea.

    Ro, the mod is simple, all you have to do is fill contents.php with html and php code, which you can copy paste from the different plugins. Most of the php code you might need is already available, you don't actually need to code anything yourself.  you just need to find it...

  • Hello I have installted elgg on my website and I tried to overwrite index.php by using hte mod : customindex

    But I'm surprised that It has no effect.

    In fact i have modified content.php to see random members but I always see the old front page?

    please help

  • I have forgotten the link to my website :

    And my objective is to show on main page the latest members.

    And when som one logged on I want to remove the page asking to add widgets



  • Hi, I just installed this and I was wondering how to get this as my index:

    On the left have the login bar, and then on the right I want to include a custom welcome message instead of displaying latest activity, memebers and groups. How do I do this? I saw the login code, I have that, but how do I now display the login to the left and a message to the right? Thanks!

  • how to show only last pages on fronpage?

  • Hello, a newbie here. I am trying to create a custom front page but getting a blank page. My environment is as follows:

    Elgg V: 1.2,
    Theme:  theme_redrounded,
    Plugin: customindex


    - Installed customindex plugin
    - Deleted extend_view('metatags','customindex/metatags') and extend_view('css','customindex/css')
    - Edited content.php (or should I say plagiarized it from kshelton360)
    - Get blank page



         * Elgg customindex plugin
         * This plugin substitutes the frontpage with a custom one
         * @package Customdash
         * @license GNU Public License version 2
         * @author Boris Glumpler
         * @copyright Boris Glumpler 2008
         * @link /

        // Put your content below

    <div id="welcome-box">
    <div id="login-box">
    $form_body = "<p><label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea')) . "</label><br />";
    $form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . "</label><br />";
    $form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . "</p>";
    $form_body .= "<p><a href=\"". $vars['url'] ."account/register.php\">" . elgg_echo('register') . "</a> | <a href=\"". $vars['url'] ."account/forgottn_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";

    echo elgg_view('input/form', array('body' => $form_body, 'action' => "". $vars['url'] ."action/login"));


    <h2>Welcome to my social website</h2>
    <p>This is where my text will go in the txt box...blah blah blah....</p>

    /**This is the section that should show the newest members*/

    <div id="newest-members">
    <h2>Newest Members</h2>

    $users = get_entities('user', '', 0, '', 25, 0, false, 0, null);
       foreach($users as $user){
          echo "<div class=\"member_icon\">" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'small')) . "</div>";


    /**This is the section that should show the latest-groups*/

    <div id="latest-groups">
    <h2>Latest Groups</h2>

    $groups = get_entities('group', '', 0, '', 25, 0, false, 0, null);
                        foreach($groups as $group){
                              echo "<div class=\"member_icon\">" . elgg_view("profile/icon",array('entity' => $group, 'size' => 'small')) . "</div>";

    /**This is the section that should show the latest-activity*/

    <div id="latest-activity">
    <h2>Latest Activity</h2>

    $content = list_registered_entities(0,12,true,false,array('object','group'));

    $content = elgg_view_layout('', '', $title . $content);

    echo $content;



    Other then the instructions in customindex, I am wondering if I am missing something. Any assistance is greatly appreciated.

  • any ideas how to show  last kaltura_video on  front page?


  • I am a newbie and I enabled the custom_index, changed a few things but here's where I'm at:

    1. I can't find the files contents.php or metatags.php under views/default/customindex? Why is that?

    2. I want to change the layout_header and wrapper_header but don't where to do this?


    Any help is greatly appreciated, thanks!

  • I was looking for this answer 3 days thtough all most powerfull search engine in the world: How to swhitch the language on loggin page to the language in the elgg system? I have sat romanian in the elgg system, nut when logged out it comes english. I need a answer , please. I do not have any keywords to continue to search for this.


    By the way, I've tranlsated all pluginsa an main en.php in romanian, if somebody needs it, let me know.



  • Can anyone help with this:

    $the_question = get_entities('question',0,4,true,false,true);

    I know it's wrong but can not seem to find the right call.  What I want to do is call the latest questions from the questions plugin.

    The rest of my index works fine, here it is:

    //get required data               
            set_context('search');//display results in search mode, which is list view
            //grab the latest 4 blog posts. to display more, change 4 to something else
            $blogs = list_entities('object','blog',0,4,false, false, false);
            //grab the latest bookmarks
            $bookmarks = list_entities('object','bookmarks',0,4,false, false, false);
            //grab the latest files
            $files = list_entities('object','album',0,5,false, false, false);
            //get the newest members who have an avatar
            $newest_members = get_entities_from_metadata('icontime', '', 'user', '', 0, 10);
            //newest groups
            $groups = list_entities('group','',0,9,false, false, false);
            //grab the login form
            $login = elgg_view("account/forms/login");
            $izap_videos = list_entities('object','izap_videos',0,8,false, false, false);
            $total_users = get_number_users(true);
            $pages = list_entities('object','page_top',0,8,false,false,false);
            $forum = list_entities('object','groupforumtopic',0,5,false,false,false);
            $the_question = get_entities('question',0,4,true,false,true);

    It's just this last line I can't get.

    Thank you

  • Hi,

    I have the folling code on my custom index to allow users to directly post to the wire.

    <div class="index_box">
    <h2><?php echo elgg_echo("Whats on your mind?"); ?></h2>
    function textCounter(field,cntfield,maxlimit) {
        // if too long...trim it!
        if (field.value.length > maxlimit) {
            field.value = field.value.substring(0, maxlimit);
        } else {
            // otherwise, update 'characters left' counter
            cntfield.value = maxlimit - field.value.length;
    <div align="center">
        <form action="<?php echo $vars['url']; ?>action/thewire/add" method="post" name="noteForm">
                    $display .= "<textarea name='note' value='' cols='50' rows='1' id=\"thewire_small-textarea\">{$msg}</textarea>";
                    echo $display;
                ?></div><div align="right">
                <input type="hidden" name="method" value="site" />
                <input type="submit" value="<?php echo elgg_echo('Share'); ?>" /></div>
        </form><div class="clearfloat"/></div>

    What do i need to add to that in order that that div only shows to logged in users, I think it's going to involve a something like if_user_logged_in display=none esle display=block but no idea what exactly to put where to make this work, can anyone help me sort this please?

  • Sorted this now,


            <!-- MY CODE -->

  • I want to make the login form only visible if you not login, but when login i would like to see the site wide activities,

    ofcourse after login in i can choose for the users to go to their dashboards, but i still want the content on the index page ( site wide activities, latest members etc) to be viewed when your loggin.


    So basicaly you have to login to see anything, how do i go about doing that ?

  • got an error if i vote in a poll but did not pick any options.

  • Hi there,

    A quick question ...

    To get items like lates blog items to be displayed on the index page we do the following:

    $blogs = list_entities('object','blog',0,5,false, false, false);

    and we call this on the new_index.php page as lollowing :

    <div id="index_box">
          <h2><?php echo elgg_echo("Laatste blog posts"); ?></h2>
                    if (isset($vars['area1']))
                        echo $vars['area1']; //display blog posts

    This ofcourse this displays the icon, title, user info and date from each 5 blog post. But how do i get the full detail of the first blog post to be displayed or even a certain amount of characters of the first blog post. 

    Example : first blog post would be ;

    Icon, title , content of post ( 100 characters), user details

    Any ideas guys how to get this done ?

    Thanks in advance for the help

  • Hi, I think I'm using this (does it come with Elgg 1.5?).  It looks good, but I haven't been able to customise the css much.  It seems like it's not picking up the css file that's in views/default/custom_index - it's just using the default one.


    I say this because no change I make to the css file makes any difference to how it looks - e.g. I tried adding black borders to all the boxes, just to test, and it didn't work.


    Is there something I need to do to get it to pick up the css file?


    Apologies if this is a really basic question - I'm totally new to Elgg and just trying to get my head around things!




  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 3
  • Updated: 2014-11-17
  • Downloads: 10686
  • Recommendations: 8