Panglossa go!Johnny PHP class library go!Johnny Developer Blog
Status: Beta
Brought to you by:
panglossa
There are basically two types of hyperlinks provided by go!Johnny: regular links (the TA class, representing a simple a tag) and javascript links (the TJSA class, whose name stands for "JavaScript A").
In both cases, the first parameter represents the resource you are linking to, while the second parameter is the text to be displayed.
<?php $sf = TA('http://sf.net', 'SourceForge'); $alert = TJSA("alert('Hello!');", 'Click here'); echo $sf . $alert;
output:
<a id="sf" href="http://sf.net" title="SourceForge"> SourceForge </a> <a id="alert" href="#" title="Click here" onclick="alert('Hello!');"> Click here </a>
When using the TJSA class, we recommend putting all your javascript in a separate .js file and include simple function calls in your links. This has the following advantages:
Example:
<?php $action = TJSA("do_something();", 'Click here'); echo $action;
output:
<a id="action" href="#" title="Click here" onclick="do_something();"> Click here </a>