Adding Latest Photo Albums to main page


Could you please explain how to add Latest Photo Albums on main page/public page?

Thank you

  • @Cash,

    Thanks for the advice. I see the point.

    Could such a plugin be a catchall for various site-specific mods? For example, at registration, I include a parenthetical comment about user names ("Don't include LEGO."). Could one site-specific plugin handle a number of unrelated changes?

    Can you tell me where functions have to be defined? They don't seem to have to be defined in the same php file that calls them, and not even within the same plugin folder.

  • Each plugin has a start.php that "boots" the plugin. It registers for events, registers actions, and defines functions that need to be available everywhere. Any function defined in a start.php for an activated plugin is available everywhere in the code. If you want to call a function defined in one plugin's start.php from another plugin, I recommend testing if the function exists first: That saves you from a crash if you disable the plugin with the function. In general, I try to minimize implicit dependencies between plugins.

    I always have a general site plugin named after the site. It contains small customizations such as what you mentioned above. I like having those all in one place. If a particular customization becomes very large, I may pull that out into a separate plugin. That's more for organization.

  • So, bottom line, which would be the best way to add Latest Albums and/or Photos to the front page?

    Thank you for your inputs.

  • @rosval...
    after 3 days of questions and answers..
    if you're now not comfortable coding with php and Elgg..
    you're gonna have a h-a-r-d time getting this "Latest Albums" piece of code developed...
    so -- what are you looking for ?

  • Best way, IMHO, would be to use custom_index_widgets. No php coding or fiddling.


  • @DhrupDeScoop
    Thank you for your reply.

    Where exactly (in what php page) are calls being made so that the latest/newest whatever...will be displayed on the front page, i.e. index.php ?

     Index.php loads the front page as such:

    /Load the front page
              global $CONFIG;
              $title = elgg_view_title(elgg_echo('content:latest'));
              $content = list_registered_entities(0,10,true,false,array('object','group'));
              global $autofeed;
              $autofeed = false;
              $content = elgg_view_layout('two_column_left_sidebar', '', $title . $content, elgg_view("account/forms/login"));
              page_draw(null, $content);

    Where should I be looking for that particular code?


  • /mod/custom_index/views/default/canvas/layouts/new_index.php

    Try putting the following untested piece of code on the above mentioned directory.


        //the number of files to display
        $number = (int) $vars['entity']->num_display;
        //if no number has been set, default to 5
        if (!$number)
            $number = 5;

        echo elgg_view('tidypics/albums', array('num_albums' => $number));


    You will could apply some css styling. ;)

  • @RV -
    What theme do you have @ Castle ?
    I have made some notes which I will post here shortly...

  • @Shouvik

    Thank you. I'll give it a shot, even though (not having a sandbox) I'm risking a crash.


    Am using Egxite™ Themer - iPhone enabled personalizable theme.

    Thank you all for your time.

  • @rosval: I don't thinkit will cause you any crash. But, even if it does, you can always change it back to previously known best configuration, can't you. ;)