$buttonId.'" href="#"
name="'.$buttonId.'">'.$text.'';
}
/**
* Adds the JavaScript to the domready event and adds the event
handler to the document
*
* @static
* @param string JavaScript to add to domready event
*/
function addScript($script = null)
{
// domready event handler
static $js;
if ($script)
{
Customizing the Page
[ 274 ]
// append script
$js .= "\n".$script;
}
else
{
// prepare domready event handler
$script="window.addEvent('domready',
function(){".$js."});"
// add event handler to document
$document =& JFactory::getDocument();
$document->addScriptDeclaration($script);
}
}
}
Notice that at no point do we tell the document that we need to include the
mootools library. This is because mootools is always included when we render an
HTML document.
So how do we use our newly created class? Well it's relatively simple. We use
startSlide() and endSlide() to indicate a slider; anything that we output
between these two calls will be within the slider. We use the button() method
to output a button, which when pressed will perform a slider event on the slider.
Pages:
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375