Jommla w szkole

By widzieć więcej...

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

addStyleSheet, addScript

Email Drukuj

// addStyleSheet

$doc =& JFactory::getDocument();
$doc->addStyleSheet( 'http://www.example.com/css/mystylesheet.css' );
//for the templates:
$this->addStyleSheet( 'templates/' . $this->template . '/css/mystylesheet.css' );

//deklaracja stylu

$doc =& JFactory::getDocument();
$style = 'BODY {'
. 'background: #00ff00;'
. 'color: rgb(0,0,255);'
. '}';
$doc->addStyleDeclaration( $style );

// addScript

$doc =& JFactory::getDocument();
$doc->addScript("http://www.example.com/js/myscript.js");

//feklaracja skryptu

$extrascript = 'alert( \'Hello Joomla!\' )';
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration( $extrascript );

//addCustomTag

$document =& JFactory::getDocument();
$document->addCustomTag("");

//CSS style sheets

$document->addHeadLink("components/com_helloworld/moolet/mootips.css", "stylesheet", "rel");




INNE

$document =& JFactory::getDocument();
$moje_pliki = JPATH_SITE.'modules'.DS.'mod_floom'.DS;
$document->addCustomTag(''); $document->addCustomTag(' google.load("mootools", "1.2.4");'); $document->addCustomTag(''); $document->addCustomTag('');
$document->addHeadLink($moje_pliki.'floom.css', 'stylesheet', 'rel');
$extrastyl=$params->get('art_css');
$document->addCustomTag(''.$extrastyl.'');
$extraskrypt='var zmienna=1;';
$document->addCustomTag(''.$extraskrypt.'');
$href = 'index.php/other/css/mycss.css';
$attribs = array('type' => 'text/css');
$document->addHeadLink( $href, 'stylesheet', 'rel', $attribs );
You are here: Joomla Api Doc addStyleSheet, addScript