Adding Latest Photo Albums to main page

Hello,

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

firstvlad@gmail.com

Thank you

  • Are you using custom_index? With or without custom_index widgets?

  • Hi Stephen,

    Using custom index, without index widgets (vazco main page, if that's what you mean).

    Thank you for your reply.  Any input is greatly appreciated.

  • Actually, customizing the front page w/o using widgets, would be a better way of putting it.

    I am not familiar with PHP, and trying to make the best/most of it.

    Thank you for your time.

  • @Rosval : there is the documentation available with tidypics plugin, inside the docs folder. The first line of it explains your problem :

     

    ...................In tidypics/lib/tidypics.php, there is a function tp_get_latest_photos().

    It can be used to display the site-wide latest photos or an individual user's latest photos............

  • @Rosval

    I inserted the following into new_index.php; I am not using Vazco's main page. Of course, this produces latest photos. But, per Webgalli's comment above, it would seem to be part of the latest albums issue.

    You and I will have to await the next comment from the cognoscenti, which  hopefully will elucidate some detail that is blindingly obvious to them, and equally obscure to you and me.

     

           <!-- tipypics images -->
    <?php
    }

    if (is_plugin_enabled('tidypics')) {
    ?>
    <!-- display latest photos -->
    <div class="index_box">
    <h2><a href="<?php echo $vars['url']; ?>pg/photos/world/"><?php echo elgg_echo("Latest Photos"); ?></a></h2>
    <div class="contentWrapper">
    <?php
    echo tp_get_latest_photos(12);
    ?>
    </div>
    </div>


    (BTW, I think the combination of custom_index and custom_index_widgets would display latest albums easily, or more easily than this php file editing.)

  • Here is some completely untested code:

    function tp_get_latest_albums($num_albums, $owner_guid = 0, $context = 'front') {
            $prev_context = set_context($context);
            $image_html = tp_list_entities('object', 'album', $owner_guid, null, $num_albums, false, false, false);
            set_context($prev_context);
            return $image_html;
    }
  • @Cash

    I understand that tp_get_latest_photos() and tp_get_latest_albums() are functions, and that you just provided a definition of the latter. Thanks.

    But,  tp_get_latest_photos() is not defined anywhere within the custom_index plugin files. It is defined in tidypics/lib/tidypics.php. 

    So, do I ... 1) add your code to tidypics/lib/tidypics.php, 2) call that function in new_index.php and 3) make some similar, analogous changes (i.e. "albums" for "photos") to custom_index/index.php?

  • Sorry to open this can of worms. However, it needs to be addressed.

    Customizing the MAIN page is essential. It should not be a PROBLEM.

    So far we have:

    Latest Files
    Latest Groups
    Latest Videos
    Newest Members
    Latest Blog Posts
    Latest Bookmarks (how relevant is that?) - Should it be on the Front page, by default?

    Adding another Latest THIS or THAT, should not be an issue.

    I would tackle it in pure HTML, making it that much more confusing. But, since this baby is PURE PHP, let's stick to the designers' idea. HOW can one customize the FRONT page?

    Thank you all for jumping at this. You rock.

     

  • By the way, the subject site is here:

    http://encounters.draculascastle.com

    Adding LATEST Photo ALbums, and/or Photos to the front page seems to be a mistery in PHP.

    NOT HTML friendly at all.

    Messing with the PHP code is also NOT a good idea. It crashes everything.

    On the plus side, we appreciate OPEN Source and open minded people. 

  • @rosval - the custom_index is more of a demo plugin than a production plugin. It is meant to demonstrate what could be done with the front page. It does require basic PHP knowledge. There is no way to do it with pure HTML unless you want a static page.

    @Stephen - I try to never edit plugin code. I keep a plugin around for site specific modifications. For example, I wouldn't use custom_index plugin. I would

    • create a <site_name> plugin
    • copy what code I needed out of custom index to create a front page
    • get that working
    • add the tp_get_latest_albums() code to the plugin's start.php
    • integrate that new function into the front page layout

    Over time you will probably want to rework your front page and move further away from the standard demo plugin distributed with Elgg. It is easier to do with this your own plugin rather than having to deal with possible upgrade issues.