From 20bb16859f4ae23d268ef656029917c7277c59f7 Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Sat, 17 Oct 2015 00:19:01 +0200 Subject: [PATCH] dirfind.php: move html to templates --- mod/dirfind.php | 35 ++++++++++++---------- view/templates/match.tpl | 65 +++++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/mod/dirfind.php b/mod/dirfind.php index 95f9bf53a8..39c13dcb73 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -38,10 +38,6 @@ function dirfind_content(&$a, $prefix = "") { $o = ''; - $o .= replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => sprintf( t('People Search - %s'), $search) - )); - if($search) { if ($local) { @@ -121,7 +117,6 @@ function dirfind_content(&$a, $prefix = "") { $id = 0; - $tpl = get_markup_template('match.tpl'); foreach($j->results as $jj) { // If We already know this contact then don't show the "connect" button @@ -143,17 +138,26 @@ function dirfind_content(&$a, $prefix = "") { $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); - $o .= replace_macros($tpl,array( - '$url' => zrl($jj->url), - '$name' => htmlentities($jj->name), - '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), - '$tags' => $jj->tags, - '$conntxt' => $conntxt, - '$connlnk' => $connlnk, - '$photo_menu' => $photo_menu, - '$id' => ++$id, - )); + $entry = array( + 'url' => zrl($jj->url), + 'name' => htmlentities($jj->name), + 'photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), + 'tags' => $jj->tags, + 'conntxt' => $conntxt, + 'connlnk' => $connlnk, + 'photo_menu' => $photo_menu, + 'id' => ++$id, + ); + $entries[] = $entry; } + + $tpl = get_markup_template('match.tpl'); + + $o .= replace_macros($tpl,array( + 'title' => sprintf( t('People Search - %s'), $search), + '$entries' => $entries, + )); + } else { info( t('No matches') . EOL); @@ -161,7 +165,6 @@ function dirfind_content(&$a, $prefix = "") { } - $o .= '
'; $o .= paginate($a); return $o; } diff --git a/view/templates/match.tpl b/view/templates/match.tpl index 3ebabf1854..db612e3dc5 100644 --- a/view/templates/match.tpl +++ b/view/templates/match.tpl @@ -1,33 +1,38 @@ +{{include file="section_title.tpl"}} + +{{foreach $entries as $entry}} +
+
+ + {{$entry.name}} + + {{if $entry.photo_menu}} + menu +
+
    + {{foreach $entry.photo_menu as $k=>$c}} + {{if $c.2}} +
  • {{$c.0}}
  • + {{else}} +
  • {{$c.0}}
  • + {{/if}} + {{/foreach}} +
+
+ {{/if}} +
+
+ +
+ {{if $entry.connlnk}} + + {{/if}} -
-
- - {{$name}} - - {{if $photo_menu}} - menu -
-
    - {{foreach $photo_menu as $k=>$c}} - {{if $c.2}} -
  • {{$c.0}}
  • - {{else}} -
  • {{$c.0}}
  • - {{/if}} - {{/foreach}} -
-
- {{/if}} -
-
- -
- {{if $connlnk}} - - {{/if}} +{{/foreach}} -
+
-- 2.39.5