[pmwiki-users] Custom Markup for a Button

Josh Miller josh at virtualmillers.net
Wed Sep 12 13:42:39 CDT 2007


Hello:

I am trying to convert the following HTML into Markup:

<div id=Button><div><a href="http://www.yahoo.com">Yahoo</a></div></div>

So it looks like this:
(:button www.yahoo.com :) or (:button [[Main.HomePage|Go Home]] :)

I have the following in my config file:

Markup('button', 'directives', '/\\(:button:\\)/e',
"Button(PSS('$1'))");
function Button ($args){
	$arg = PSS(ParseArgs($args));
	if (isset($arg['$1'])) {
		if (isset($arg['$1'])) $buttontext = $arg['$1'];
		$out = "<div id=Button><div> $buttontext";
		$out.= "</div></div>";
	}
	else{
		 $out = "<div
id=Button><div>[[Main.HomePage]]</div></div>";	
	}
	return $out;
}

It's not quite working...what am I missing?

(if you want to try it so it looks like a button, here is the CSS Code
for the button)

#Button a {
	color: #FFF;
	font-size:10px;
	font-family:verdana;
	font-weight:bold;
	text-decoration: none;
	text-align: center;
	border:2px outset blue;
	background-color:#009;
	display: block;
	width: 160px;
	padding: 2px 5px;
	margin: 3px 0px 2px 20px;
}

#Button a:hover {
	background-color: #006;
	color:#FF0;
	padding-left:4px;
	border:2px inset #009;
}

Thanks!
-Josh Miller
Gouverneur




More information about the pmwiki-users mailing list