SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 348 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


???
???
Customizing the Page
[ 262 ]
CSS
In order to add CSS styles cleanly they should be added to the document header. We
can use the methods addStyleSheet() and addStyleDeclaration() to add CSS.
addStyleSheet() is used to add a link to an external CSS file. This is an example of
how to use the addStyleSheet() method:
$css = JURI::base().'components/com_foobar/assets/style.css';
$document =& JFactory::getDocument();
$document->addStyleSheet($css);
The nice thing about using this method is we can also specify the media type to
which the styles apply. Imagine we have a special CSS file that is intended to
format a document when we come to print. To achieve this we can specify the
media type print:
$document->addStyleSheet($css, 'text/css', 'print');
Notice that the second parameter is text/css; this parameter is used to identify
the MIME type and is used in the same way as it is in the addScript() and
addScriptDeclaration() methods.
The third parameter is the media type, in this case print.


Pages:
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6