CSS file paths different to ones defined

sdemps 20 Mar, 2015
I am trying to add some CSS Files to my form so I went into Setup and under CSS I added a few paths, for example :

//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css
fileupload/css/style.css
//blueimp.github.io/Gallery/css/blueimp-gallery.min.css
fileupload/css/jquery.fileupload.css

Now when I test the form and check the css links, I see that some strange paths have been appended to my paths!!!! See below

<link rel="stylesheet" href="http://127.0.0.1/repositories/trunk/libraries/cegcore///netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1/repositories/trunk/libraries/cegcore/fileupload/css/style.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1/repositories/trunk/libraries/cegcore///blueimp.github.io/Gallery/css/blueimp-gallery.min.css" type="text/css" />
<link rel="stylesheet" href="http://127.0.0.1/repositories/trunk/libraries/cegcore/fileupload/css/jquery.fileupload.css" type="text/css" />

Any ideas why it does this and how to prevent the path being edited?

Best Regards
Shane
sdemps 20 Mar, 2015
One further question. I want to include a <noscript> tag so in CSS Code I included this

<noscript>
<?php
$doc =& JFactory::getDocument();
$doc->addStylesheet('fileupload/css/jquery.fileupload-noscript.css');
$doc->addStylesheet('fileupload/css/jquery.fileupload-ui-noscript.css');
?>
</noscript>


But I get the error

Fatal error: Call to undefined method JDocumentHTML::addCssCode() in trunk\administrator\components\com_chronoforms5\chronoforms\actions\css\css.php on line 38
GreyHead 23 Mar, 2015
Hi Shane,

There are some new oddities because of the way that CFv5 is set up. Please change you noscript code to this:
<noscript>
<?php
$jdoc = \JFactory::getDocument();
$jdoc->addStylesheet('fileupload/css/jquery.fileupload-noscript.css');
$jdoc->addStylesheet('fileupload/css/jquery.fileupload-ui-noscript.css');
?>
</noscript>

The changes are:

+ $doc becomes $jdoc as Max has used $doc for something else in CFv5

+ =& becomes just = as there are changes in PHP v5

+ JFactory becomes \JFactory as CFv5 uses its own PHP Namespace and \ refers back to the parent library.

The only satisfactory way I have found to add URL to the Load JS/CSS Files boxes is either to add a full URL which is cumbersome or to use PHP like this
<?php
// for a local file
echo \JURI::root().'bootstrap/3.2.0/css/bootstrap.min.css';
echo "\n";
// for a remote file
echo 'http://blueimp.github.io/Gallery/css/blueimp-gallery.min.css';
echo "\n";
. . .
?>
Not that the echo "\n"; lines are there to insert line breaks between the file names.

Generally I prefer the $jdoc method above.

Bob
This topic is locked and no more replies can be posted.