Project

General

Profile

Actions

Feature #17586

closed

Featurerequest: config.inlineStyle2TempFile.media

Added by Daniel Wegener about 17 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2007-09-06
Due date:
% Done:

0%

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

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)


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Feature #26372: Add media type configuration option for TypoScript setting config.inlineStyle2TempFile Closed2011-04-28

Actions
Actions #1

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 = '
&lt;script type=&quot;text/javascript&quot; src=&quot;&#039;.htmlspecialchars($GLOBALS[&#039;TSFE&#039;]-&gt;absRefPrefix.$script).'">&lt;/script&gt;';
break;
case 'css':
$script = 'typo3temp/stylesheet_'.substr(md5($str),0,10).'.css';
$mediaTag = ($media === null)'':' media="'.$media.'"';
$output = '
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&#039;.htmlspecialchars($GLOBALS[&#039;TSFE&#039;]-&gt;absRefPrefix.$script).'"'.$mediaTag.' />';
break;
}
// Write file:
if ($script) {
if (!@is_file(PATH_site.$script)) {
t3lib_div::writeFile(PATH_site.$script,$str);
}
}
return $output;
}
Actions #2

Updated by Daniel Wegener almost 17 years ago

i.e this would be nicer as a stdWrap

Actions #3

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.

Actions #4

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"

Actions #5

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?

Actions #6

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Actions

Also available in: Atom PDF