Wiki source for AbbreviationAction


Show raw source

=====Abbreviation Action=====

>>==See also:==
~-Documentation: AbbreviationActionInfo
~-Alternative approach: AcronymFormatter
>>This is the development page for the abbreviation action.::c::

The php code:
%%(php)
<?php
/**
* Create a <abbr> or <acronym> link.
*
* Usage: {{abbr type="acronym" short="IMHO" long="In My Humble Opinion"}}
*
* @package Actions
* @subpackage
* @name abbr
*
* @author {@link http://wikka.jsnx.com/ChristianBarthelemy Christian Barthelemy} - original idea and code.
* @version 0.1
* @since Not (yet?) part of offical Wikka release
*
* @input string $type optional: the type of abbreviation
* default is abbr any other value means acronym - will be used as the html tag and as the name of the class too
*
* @input string $short required: the short writting that needs to be explained
*
* @input string $long optional: the long text to explain the meaning of the short one
* default is empty - it assumes that it has been previously provided in the same page
*
* @todo Nothing I can think about for now.
*
*/

// set defaults
$type = "abbr";
$output = "";

// ***** PARAMETERS Interface *****
$uType = $vars['type'];
if ($uType) $type = "acronym";

$uShort = $vars['short'];
if ($uShort) $short = $uShort;

$uLong = $vars['long'];
if ($uLong) $long = $uLong;
// ***** end PARAMETERS Interface *****

// ***** HTML code generation *****
// if short parameter hasn't been provided nothing is done
if ($short) {
$output="<".$type." class=\"".$type."\" ";
if ($long) {$output.="TITLE=\"".$long."\">";}
$output.=$short."</".$type.">";
}
// ***** end HTML code generation *****
print $output;
?>
%%

The added css (example):
%%(css)
.abbr {
color: red;
cursor: hand;
}

.acronym {
color: red;
cursor: hand;
}
%%
----
CategoryUserContributions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki