diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-06-21 21:47:47 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-06-21 21:47:47 +0000 |
commit | 8a76d53f35eabe1b33f012e91fd745c1e0653203 (patch) | |
tree | e7bf1fc433e499e2fa45f79a623a6a120f6b62f1 /lib/tidypics.php | |
parent | 779ff6e97e53a016b9384427d65d98daf6480e24 (diff) | |
download | elgg-8a76d53f35eabe1b33f012e91fd745c1e0653203.tar.gz elgg-8a76d53f35eabe1b33f012e91fd745c1e0653203.tar.bz2 |
added convenience function for front page
Diffstat (limited to 'lib/tidypics.php')
-rw-r--r-- | lib/tidypics.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/tidypics.php b/lib/tidypics.php index 1254f3ff6..d81b3ab2f 100644 --- a/lib/tidypics.php +++ b/lib/tidypics.php @@ -5,6 +5,41 @@ */
/**
+ * Get images for display on front page
+ *
+ * @param int number of images
+ * @param int (optional) guid of owner
+ * @return string of html for display
+ *
+ * To use with the custom index plugin, use something like this:
+
+ 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("tidypics:mostrecent"); ?></a></h2>
+ <div class="contentWrapper">
+ <?php
+ echo tp_get_latest_photos(5);
+ ?>
+ </div>
+ </div>
+<?php
+ }
+?>
+
+ * Good luck
+ */
+ function tp_get_latest_photos($num_images, $owner_guid = 0)
+ {
+ $prev_context = set_context('front');
+ $image_html = list_entities('object', 'image', $owner_guid, $num_images, false, false, false);
+ set_context($prev_context);
+ return $image_html;
+ }
+
+
+ /**
* Get image directory path
*
* Each album gets a subdirectory based on its container id
|