From 4e3583ab4563028309db7d75b350782b05a22b9b Mon Sep 17 00:00:00 2001
From: Mario Vavti <mario@mariovavti.com>
Date: Mon, 18 May 2015 22:18:01 +0200
Subject: allow block title to contain $content title

---
 include/comanche.php | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

(limited to 'include/comanche.php')

diff --git a/include/comanche.php b/include/comanche.php
index fc4e4004b..1c9fad8f1 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -167,12 +167,21 @@ function comanche_block($s, $class = '') {
 			dbesc($name)
 		);
 
+		//print_r($r); killme();
+
 		if($r) {
 			$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
-			if($r[0]['title'])
+
+			if($r[0]['title'] && trim($r[0]['title']) != '$content') {
 				$o .= '<h3>' . $r[0]['title'] . '</h3>';
+			}
+
+			if($r[0]['title'] && trim($r[0]['title']) === '$content') {
+				$o .= '<h3>' . get_app()->data['webpage'][0]['title'] . '</h3>';
+			}
+
 
-			if($r[0]['body'] === '$content') {
+			if(trim($r[0]['body']) === '$content') {
 				$o .= prepare_text(get_app()->data['webpage'][0]['body'], get_app()->data['webpage'][0]['mimetype']);
 			}
 			else {
-- 
cgit v1.2.3


From 9b64301e0c4af9f7b94b31e48b499d749f91c705 Mon Sep 17 00:00:00 2001
From: Mario Vavti <mario@mariovavti.com>
Date: Mon, 18 May 2015 22:19:08 +0200
Subject: remove dbg code

---
 include/comanche.php | 2 --
 1 file changed, 2 deletions(-)

(limited to 'include/comanche.php')

diff --git a/include/comanche.php b/include/comanche.php
index 1c9fad8f1..cca7cb0f6 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -167,8 +167,6 @@ function comanche_block($s, $class = '') {
 			dbesc($name)
 		);
 
-		//print_r($r); killme();
-
 		if($r) {
 			$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
 
-- 
cgit v1.2.3


From 9b1e54088051cd2d913aba49dff76acc454e1579 Mon Sep 17 00:00:00 2001
From: Mario Vavti <mario@mariovavti.com>
Date: Mon, 18 May 2015 22:29:13 +0200
Subject: if block title contains $content but $content title is empty do not
 show an empty <h3> tag

---
 include/comanche.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'include/comanche.php')

diff --git a/include/comanche.php b/include/comanche.php
index cca7cb0f6..93cbd8b12 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -174,7 +174,7 @@ function comanche_block($s, $class = '') {
 				$o .= '<h3>' . $r[0]['title'] . '</h3>';
 			}
 
-			if($r[0]['title'] && trim($r[0]['title']) === '$content') {
+			if($r[0]['title'] && trim($r[0]['title']) === '$content' && get_app()->data['webpage'][0]['title']) {
 				$o .= '<h3>' . get_app()->data['webpage'][0]['title'] . '</h3>';
 			}
 
-- 
cgit v1.2.3