Feature #17586
closedFeaturerequest: config.inlineStyle2TempFile.media
0%
Description
It would be nice to have an "string / stdWrap" for config.inlineStyle2TempFile which enables the user to set a media-attribute for the generated style-link.
Further it would be nicer if this value contains stdWrap-functionality for special purposes (cannot think of a case now, but its always nice to have one).
expected behavior:
config.inlineStyle2TempFile.media = all
OUTPUT:
[...]
<link rel="stylesheet" type="text/css" href="typo3temp/stylesheet_bcc2a2f479.css" media="all" />
[...]
config.inlineStyle2TempFile.media = screen
config.inlineStyle2TempFile.media.wrap = |,tv
OUTPUT:
[...]
<link rel="stylesheet" type="text/css" href="typo3temp/stylesheet_bcc2a2f479.css" media="screen,tv" />
[...]
The need to this functionality is the idea of a simply styled print-version (without an extra template), just multiple css-files with media-attributes.
Most Browsers are not able to render the printversion correctly (using those css-files that match their media type). If their is (at least) one style-tag without a media-attribute, it would ALWAYS (media-independent) use this and all following CSS-files (ignoring the media-type of the following attributes).
more information:
http://www.howtocreate.co.uk/tutorials/css/mediatypes
(issue imported from #M6286)
Updated by Daniel Wegener almost 17 years ago
its not that much...
here we go: typo3/sysext/cms/tslib/class.tslib_pagegen.php
update the following:
in Line 628 (renderContentWithHeader) change:
$GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile($style, 'css', $GLOBALS['TSFE']->config['config']['inlineStyle2TempFile.']['media']);
And update the following method:
/**
* Writes string to a temporary file named after the md5-hash of the string
*
* @param string CSS styles / JavaScript to write to file.
* @param string Extension: "css" or "js"
* @param string Media (for CSS): String like "screen, presentation", "all" or "print"
* @return string <script> or <link> tag for the file.
*/
function inline2TempFile($str,$ext,$media=null) {
// Create filename / tags:
$script = '';
switch($ext) {
case 'js':
$script = 'typo3temp/javascript_'.substr(md5($str),0,10).'.js';
$output = '
<script type="text/javascript" src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'"></script>';
break;
case 'css':
$script = 'typo3temp/stylesheet_'.substr(md5($str),0,10).'.css';
$mediaTag = ($media === null)'':' media="'.$media.'"';
$output = '
<link rel="stylesheet" type="text/css" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'"'.$mediaTag.' />';
break;
}
// Write file:
if ($script) {
if (!@is_file(PATH_site.$script)) {
t3lib_div::writeFile(PATH_site.$script,$str);
}
}
return $output;
}
Updated by Daniel Wegener almost 17 years ago
i.e this would be nicer as a stdWrap
Updated by Dmitry Dulepov almost 17 years ago
It is not possible to have subproperties inside "config". I.e. it can be only config.whatever but not config.whatever.whateverelse.
Updated by Daniel Wegener almost 17 years ago
strange - i thought ive seen it for some extensions (config.coolExtension.bleh) - but indeed - might be an unclean solution.
however, than call it
"config.inlineStyle2TempFileMedia"
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0) - TYPO3 Version set to 4.1
As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?
Updated by Alexander Opitz about 11 years ago
- Status changed from Needs Feedback to Closed
No feedback for over 90 days.