From 23bca4f3845d2ee190cdcbd04ecb5452c1fc502f Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 6 Nov 2010 23:11:25 +0000 Subject: finished design, improved template functions --- tpl_functions.php | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'tpl_functions.php') diff --git a/tpl_functions.php b/tpl_functions.php index 6dc9e4bc2..0dfee9595 100644 --- a/tpl_functions.php +++ b/tpl_functions.php @@ -1,37 +1,66 @@ */ -function _tpl_discussion($discussNS='discussion:',$link=0) { +function _tpl_discussion($discussNS='discussion',$link=0,$wrapper=0,$reverse=0) { global $ID; - if(substr($ID,0,strlen($discussNS))==$discussNS) { - $backID = substr(strstr($ID,':'),1); + + if ($reverse) { + $discussPage = $ID.':'.$discussNS; + $isDiscussPage = substr($ID,-strlen($discussNS),strlen($discussNS))==$discussNS; + $backID = substr($ID,0,-strlen($discussNS)); + } else { + $discussPage = $discussNS.':'.$ID; + $isDiscussPage = substr($ID,0,strlen($discussNS))==$discussNS; + $backID = strstr($ID,':'); + } + + if ($wrapper) echo "<$wrapper>"; + + if($isDiscussPage) { if ($link) - tpl_link(wl($backID),tpl_getLang('btn_back2article')); + tpl_pagelink($backID,tpl_getLang('back_to_article')); else - echo html_btn('back2article',$backID,'',array()); + echo html_btn('back2article',$backID,'',array(),0,0,tpl_getLang('back_to_article')); } else { if ($link) - tpl_link(wl($discussNS.$ID),tpl_getLang('btn_discussion')); + tpl_pagelink($discussPage,tpl_getLang('discussion')); else - echo html_btn('discussion',$discussNS.$ID,'',array()); + echo html_btn('discussion',$discussPage,'',array(),0,0,tpl_getLang('discussion')); } + + if ($wrapper) echo ""; } /** * Create link/button to user page + * + * @author Anika Henke */ -function _tpl_userpage($userNS='user:',$link=0) { +function _tpl_userpage($userNS='user',$link=0,$wrapper=false) { + if (!$_SERVER['REMOTE_USER']) return; + global $conf; + $userPage = $userNS.':'.$_SERVER['REMOTE_USER'].':'.$conf['start']; + + if ($wrapper) echo "<$wrapper>"; + if ($link) - tpl_link(wl($userNS.$_SERVER['REMOTE_USER'].':'.$conf['start']),tpl_getLang('btn_userpage')); + tpl_pagelink($userPage,tpl_getLang('userpage')); else - echo html_btn('userpage',$userNS.$_SERVER['REMOTE_USER'].':'.$conf['start'],'',array()); + echo html_btn('userpage',$userPage,'',array(),0,0,tpl_getLang('userpage')); + + if ($wrapper) echo ""; } -- cgit v1.2.3