Project

General

Profile

Actions

Feature #24463

closed

Epic #55575: Streamline JavaScript Code in the TYPO3 Backend

Add Javascript-Files from CDN

Added by Anonymous over 13 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2011-01-03
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

At this moment, there is no possibility to load Javascript-Files from the internet.
The PageRenderer will insert only local files:
$properties['file'] = t3lib_div::resolveBackPath($properties['file']);
$properties['file'] = t3lib_div::createVersionNumberedFilename($properties['file']);

So if I use the follow config in HOOK:
$params['jsLibs']['jQueryTOOLS'] = array(
'file' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js',
'section' => t3lib_PageRenderer::PART_HEADER,
'forceOnTop' => true,
);
The file will not be loaded, because it is not on the filesystem.

This should work for jsLibs and jsFile

Best regards
Jürgen

(issue imported from #M16903)

Actions #1

Updated by Anonymous over 13 years ago

Please close this Issue.
After some trying, it seems to work fine.

Best regards
Jürgen

Actions #2

Updated by Steffen Gebert over 13 years ago

Jürgen, would be nice if you could explain, how you solved this issue (could help others..). In this case, please reopen!

You can use the external = 1 attribute to disable the file_exists() checks. At least in TypoScript it's available.
page.includeJS.jQuery = http://cdn.whatever
page.includeJS.jQuery.external = 1

Actions #3

Updated by Anonymous over 13 years ago

I include the script by HOOK:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess']['jquery'] = "EXT:myext/class.tx_myclass.php:&tx_myext->addJqByHook";
The Methode looks like this:
class tx_myext {
function addJqByHook($params) {
$params['jsLibs']['jQuery'] = array(
'file' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js',
'section' => t3lib_PageRenderer::PART_HEADER,
'forceOnTop' => true,
);
}
}

This will work in Typo3 4.3.x and newer

Actions #4

Updated by Steffen Gebert over 13 years ago

Um... It's really bad that it seems not to be possible to set "external" attribute using PHP API.

However for your case, I would recommend you to add it using TypoScript

Actions #5

Updated by Anonymous over 13 years ago

Sorry, seems to be a misunderstanding, the methode above works.
I had the feeling it does not work, so I reported it as a bug.
So in first place the bug report of mine was the bug ;)

Actions #6

Updated by Steffen Gebert over 13 years ago

Yes, but it's a bad method ;-)

We have an API for that t3lib_pageRenderer::addJsFile(), however this is not able to cope with the "external" flag.

Actions #7

Updated by Anonymous over 13 years ago

Yea, I know
But I have to use it, because I cant use the pageRenderer in This way.
When I set the Script, the pagerenderer isnt set to $GLOBALS.
The EXT I use there is t3jquery, hard thing ;)

Actions #8

Updated by Daniel Siepmann about 10 years ago

  • Target version deleted (0)
  • Parent task set to #55575
Actions #9

Updated by Benni Mack over 9 years ago

  • Status changed from Accepted to Needs Feedback

Hey Jürgen,

could we close this one now?

Actions #10

Updated by Anonymous over 9 years ago

Yes, close it, I stopped developping for TYPO3, so I do not need this anymore

Actions #11

Updated by Benni Mack about 9 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF