regClientCSS

API Function Definition
CMS versions: 0.9.x + Evo
Input parameters: The style tag block containing the CSS code OR
The link tags with the link to the .css file OR
The URL to the .css file

function regClientCSS(string $src);

Registers Client-side CSS scripts - these scripts are loaded just above the </head> tag.

Since the code is inserted into the template's head, your template must have head tags!

Usage / Examples

$myCSS = '<style media="screen">
* {margin:0; padding:0;}
</style>';
$modx->regClientCSS( $myCSS );

Related Functions

  • ?regClientStartupScript
  • regClientScript
  • regClientStartupHTMLBlock
  • regClientHTMLBlock

Function Source

API Source File - manager/includes/document.parser.class.inc.php
line 2287 in 1.0.5

function regClientCSS($src) {
if (isset ($this->loadedjscripts[$src]) && $this->loadedjscripts[$src])
return '';
$this->loadedjscripts[$src]= true;
if (stripos($src, "<style") !== false || stripos($src, "<link") !== false) {
$this->sjscripts[count($this->sjscripts)]= $src;
} else {
$this->sjscripts[count($this->sjscripts)]= '<!-- Evo registered -->' . "\n" . '  <link href="' . $src . '" />';
}
}

Suggest an edit to this page.