php - joomla get content in onBeforeCompileHead function -
i'm developing joomla system plugin. need add javascript , css files if [myshortcode]
shortcode found in content.
how can content in onbeforecompilehead function
function onbeforecompilehead() { $document = jfactory::getdocument(); //add scripts if shortcode found ... $document->addstylesheet($cssfile, 'text/css', null, array());
the $content = jresponse::getbody();
not work.
thanks
try this,
for style sheet,
$document = jfactory::getdocument(); $document->addstylesheet('http://domain.com/templates/css/style.css');
for javascript file
$document = jfactory::getdocument(); $document->addscript('full url');
also can this,
$document = jfactory::getdocument(); // add javascript $document->addscriptdeclaration(' window.event("domready", function() { alert("an inline javascript declaration"); }); '); // add styles $style = 'body {' . 'background: #00ff00;' . 'color: rgb(0,0,255);' . '}'; $document->addstyledeclaration($style);
if case jquery issue can try addcustomtag option here
hope helps..
Comments
Post a Comment