[pmwiki-users] hide buttons unless logged in

Hans design5 at softflow.co.uk
Thu Oct 11 04:12:37 CDT 2007


Thursday, October 11, 2007, 9:14:52 AM, Hans wrote:

> The Parchment skin does not use Site.PageActions, but has all actions
> defined in the parchment.tmpl file (in div id="pageactions" and
> div id="footer"). So this would need to be modified
> radically in order to use conditional markup for hiding the action
> links.

Here is a modified parchment skin, which enables you to use markup
(:noaction:) to hide page actions in the top as well as in the footer.


1. create a new file skin.php in the parchment folder, with:

<?php if (!defined('PmWiki')) exit();
Markup('noaction', 'directives',
  '/\\(:noaction:\\)/ei',
  "NoAction2()");
function NoAction2 () {
        SetTmplDisplay('PageActionFmt',0);
        SetTmplDisplay('PageFooterFmt',0);
        return "";
}



2. Replace your parchment.tmpl file with this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>$WikiTitle | {$Group} / {$Title} $ActionTitle</title>
<link rel='stylesheet' href='$SkinDirUrl/parchment.css' type='text/css' />
<!--HTMLHeader-->
</head>
<body>
<div id="topcontent">
<!--PageActionFmt-->
        <div class='pageactions'><!--wiki:{$Group}.PageActions {$SiteGroup}.PageActions--></div>
<!--/PageActionFmt-->
</div>
<div id="header">
<!--PageHeaderFmt-->
<a href='{$ScriptUrl}'><img src='$PageLogoUrl' alt='$WikiTitle' border='0' /></a>
</div>
<!--/PageHeaderFmt-->
<div id="body">
<!--PageTitleFmt-->
<div id="pagetitle">
<a href='{$ScriptUrl}/{$Group}'>{$Group}</a> / {$Title}
</div>
<div id="pagetext">
<br />
<!--PageText-->

<!--PageFooterFmt-->
<div id="footer">
<div class='pageactions'><!--wiki:{$Group}.PageActions {$SiteGroup}.PageActions--></div>
&nbsp; &nbsp; 
$[Page last modified on {$LastModified}]
</div>
<!--/PageFooterFmt-->
</div>
<!--PageLeftFmt-->
<div id="menu">
<b>Navigation</b>
<!--wiki:{$Group}.SideBar {$SiteGroup}.SideBar-->
<!--/PageLeftFmt-->
</div>
</div>
<!--HTMLFooter-->
</body>
</html>



3. replace your parchment.css file with this:

body {
font: 76%/150% verdana,sans-serif;
background: #dcd2b9 url("parchment.jpg") 0px 0px;
color: #000000;
margin: 0px;
padding: 0px;
}

#topcontent {
position: absolute;
top: 5px;
right: 20px;
}

.pageactions { 
  white-space:nowrap; 
}
.pageactions ul { list-style:none; margin:0px; padding:0px; }
.pageactions li { display:inline; margin:0px 5px; }
.pageactions li a.createlink { display:none; }
.pageactions li a:hover { text-decoration:underline; color:blue; }
.pageactions li a:visited { color: #a74000; }
.pagegroup { margin-top:8px; margin-bottom:2px; }
.pagetitle { line-height:1em; margin:0px; font-size:1.6em; font-weight:normal; }

#header {
position: absolute;
padding: 15px 0 0 20px;
width: 300px;
height: 45px;
text-align: left;
}

#body {
position: absolute;
top: 60px;
width: 100%;
margin-bottom: 30px;
}

#pagetitle {
position: absolute;
left: 20px;
font-weight: bold;
}

#pagetitle a {
font-weight: bold;
}

#pagetext {
float: left;
width: 72%;
top: 0px;
padding: 20px 5px 5px 20px;
}

#footer {
font-size: 90%;
padding: 30px 0 0 1px;
}


#menu {
float: right;
width: 22%;
margin: 30px 0 0 0;
font-size: 100%;
overflow: hidden;
padding: 0 12px 10px 2px;
}

#menu ul {
list-style-type: square;
list-style-image: none;
margin: 0px 0px 10px 10px;
padding: 0px;
}

.stress {
font-size: 120%;
font-weight: 600;
margin: 15px;
}

#wikiedit textarea {
width:100%;
}

td {
padding: 3px 5px 3px 5px;
}

pre {
padding: 3px 5px 3px 5px;
background: #e6dbc7;
font-size: 135%;
overflow: auto;
}

code {
font-size: 135%;
overflow: auto;
}

hr {
height: 1px;
background-color: #411900;
}

h1 {
font-size: 28px;
font-weight: normal;
margin: 0px;
letter-spacing: 2px;
line-height: 28px;
}

h2 {
font-size: 170%;
font-weight: normal;
}

h3 {
font-size: 110%;
letter-spacing: 3px;
font-weight: normal;
margin: 6px 0px;
}

h1, h2, h3 {
}

a:link {
text-decoration: none;
font-weight: normal;
color: #a74000;
}

a:visited {
text-decoration: none;
font-weight: normal;
color: #52306e;
}

a:hover {
text-decoration: underline;
color: #e00004;
}

a.createlinktext {
color: red;
}

ul {
list-style-type: square;
list-style-image: url("bullet.gif");
margin: 0px 0px 10px 10px;
padding: 0px;
}



The new parchment skin will use Site.PageActions to define all
actions, which will be used in the top and the footer.
(:noaction:) will hide both.

  ~Hans




More information about the pmwiki-users mailing list