diff options
-rw-r--r-- | engine/lib/elgglib.php | 11 | ||||
-rw-r--r-- | mod/profile/views/default/profile/listing.php | 46 | ||||
-rw-r--r-- | views/default/search/listing.php | 33 |
3 files changed, 59 insertions, 31 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index bd1f12448..166757ea4 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -463,6 +463,17 @@ }
/**
+ * Wrapper function to display search listings.
+ *
+ * @param string $icon The icon for the listing
+ * @param string $info Any information that needs to be displayed.
+ * @return string The HTML (etc) representing the listing
+ */
+ function elgg_view_listing($icon, $info) {
+ return elgg_view('search/listing',array('icon' => $icon, 'info' => $info));
+ }
+
+ /**
* Sets an alternative function to handle templates, which will be passed to by elgg_view.
* This function must take the $view and $vars parameters from elgg_view:
*
diff --git a/mod/profile/views/default/profile/listing.php b/mod/profile/views/default/profile/listing.php index 6b6381f64..3b322f799 100644 --- a/mod/profile/views/default/profile/listing.php +++ b/mod/profile/views/default/profile/listing.php @@ -12,36 +12,20 @@ * @uses $vars['entity'] The user entity
*/
-?>
-
- <div class="search_listing">
+ $icon = elgg_view(
+ "profile/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
- <div class="search_listing_icon">
- <?php
-
- echo elgg_view(
- "profile/icon", array(
- 'entity' => $vars['entity'],
- 'size' => 'small',
- )
- );
-
- ?>
- </div>
- <div class="search_listing_info">
- <p><b><?php
-
- echo "<a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a>";
-
- ?></b></p>
- <?php
-
- $location = $vars['entity']->location;
- if (!empty($location)) {
- echo "<p>" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
- }
-
- ?>
- </div>
+ $info = "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a></b></p>";
- </div>
\ No newline at end of file + $location = $vars['entity']->location;
+ if (!empty($location)) {
+ $info .= "<p>" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
+ }
+
+ echo elgg_view_listing($icon, $info);
+
+?>
\ No newline at end of file diff --git a/views/default/search/listing.php b/views/default/search/listing.php new file mode 100644 index 000000000..8ffad8ffa --- /dev/null +++ b/views/default/search/listing.php @@ -0,0 +1,33 @@ +<?php
+
+ /**
+ * Elgg search listing
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+?>
+
+ <div class="search_listing">
+
+ <div class="search_listing_icon">
+ <?php
+
+ echo $vars['icon'];
+
+ ?>
+ </div>
+ <div class="search_listing_info">
+ <?php
+
+ echo $vars['info'];
+
+ ?>
+ </div>
+
+ </div>
\ No newline at end of file |