Need help in custom_index (Tidypics)

I´m in need of a seperate box for my custim_index page.

I want to show some thumbs of the Tidypics plugin in a seperate box but i have no clue what to do.

I used (recently) Vasco´s Mainpage Widget based Intex but since i moved to a newer custom index i dont need it.

 

Here is the code Vasco used in his plugin to show the latest Images (which wont work in my custom_index):

 

    if (is_plugin_enabled('tidypics')){   
        $limit = get_plugin_setting('tidypics_num_items','vazco_mainpage');
        if (!isset($limit) || !$limit) $limit = 30;   
   
        $images = get_entities('object','image',0,0,$limit, false, false);
?>
<div class="index_box">
    <h2><?php echo elgg_echo("custom:tidypics"); ?></h2>
   
    <div class="search_listing">
    <?php
       
        if(isset($images)) {
            $counter = 0;
            echo '<div class="frontpage_tidypics_box">';
                       
            foreach($images as $image){
                $counter +=1;
                if ($counter == 6){
                    $counter = 0;
                    echo "</div>";
                    echo '<div class="frontpage_tidypics_box">';
                }
               
                echo "<div class=\"tidypics_index\">";
                echo elgg_view("vazco_mainpage/tidypics/icon", array(
                        'mimetype' => $image->mimetype
                        ,'thumbnail' => $image->thumbnail
                        ,'file_guid' => $image->guid
                        ,'link' => $image->getUrl()
                        ,'size' => 'small'
                    ));
                echo "</div>"; //tidypics_index
            }
            echo '</div>';
        }else{
            echo elgg_echo('vazco_mainpage:tidypics:noactivity');
        }
    ?>
    </div>
</div>
<?php }?>

  • Here's what i did:

    In custom_index/index.php, before the elgg_view_layout() call, add:

        $photos = list_entities('object','image',0,4,false, false, false);

    In custom_index/views/default/canvas/layouts/new_index.php, add the following where you want the pictures to show up:

    <?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 images"); ?></a></h2>
            <?php
                    if (!empty($vars['area7'])) {
                        echo $vars['area7'];//this will display photos
                    }else{
                        echo "<p>" . elgg_echo("No photos available") . "</p>";
                    }
                ?>
            </div>
    <?php
        }
    ?>

    I don't recall where I got that code from. The problem I have with the above is that I get not just the thumbnail, but also the user, date, title, etc. I'd love to get just the thumbs so that it was more like the new users box where you get just their avatars. I haven't explored yet how to get that to work though.

    You can see this in action at www.sharedphotons.com

    Tim

  • Hi skypanther,

    I tried your code but nothing returned on the index page. It's show only: No photos available.

    area7 is empty.

  • I had no luck with that script.

    The one i posted above is what you are searching for (displaying small thumbs (30) in a box.

    I hope someone can help us in this.

  • I hired vazco add this onto my index.

  • You can see my actual progress on the Tab on http://pixel4tune.de/social/

    But like skypanther said before: only icons would be better and we could display more images.

  • Hi all, this should works

    Edit mod/custom_index/views/default/canvas/layouts/new_index.php, add the following where you want the pictures to show up

    <?php
        if(is_plugin_enabled('tidypics')){
            $photos = get_entities('object', 'image', 0, 0, 12, false, false);
            if(isset($photos)) {
                echo '<div class="index_box">';
                echo '<h2>'.elgg_echo("Latest images").'</h2>';
                $counter = 0;
                echo '<div class="frontpage_tidypics_box">';
    ?>
                <!-- display latest photos -->
               
                <?php
                    foreach ($photos as $photo) {
                        $counter +=1;
                        if ($counter == 7){
                            $counter = 0;
                            echo "</div>";
                            echo '<div class="frontpage_tidypics_box">';
                        }
                        echo "<div class=\"tidypics_index\">";
                        echo elgg_view("custom_index/tidypics/icon", array(
                                'mimetype' => $photo->mimetype
                                ,'thumbnail' => $photo->thumbnail
                                ,'file_guid' => $photo->guid
                                ,'link' => $photo->getUrl()
                                ,'size' => 'small'
                            ));
                        echo "</div>";
                    }
                ?>
                    </div>
                </div>
    <?php
            }
        }
    ?>

     

  • This Code works for me perfectly:

    <?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("Najnowsze Zdięcia"); ?></a></h2>
                <div class="contentWrapper">
                <?php
                    echo tp_get_latest_photos(12);
                ?>
                </div>
            </div>

     

    ________________________________________________________________________

     

    You can see result of this code on my frontpage

  • Hi rogal

    can u please help me by telling how to implement this code ? where to post it ?

    PLeas Im a total newbie in here :)