Commit 7e87186d authored by Kasper Skårhøj's avatar Kasper Skårhøj
Browse files

Added "relPathprefix" to TEMPLATE cObject and also added support for relative...

Added "relPathprefix" to TEMPLATE cObject and also added support for relative path substitution of references in url() wrappers in <style> tags. This will also fix THAT problem reported for automaketemplate.


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@276 709f56b5-9817-0410-a4d7-c38de5d9e867
parent 098b72b3
2004-05-07 Kasper Skårhøj,,, <kasper@typo3.com>
* Added "relPathprefix" to TEMPLATE cObject and also added support for relative path substitution of references in url() wrappers in <style> tags. This will also fix THAT problem reported for automaketemplate.
2004-04-30 Kasper Skårhøj,,, <kasper@typo3.com>
* Merged TYPO3_3-6-0 branch changes by robert into HEAD. See 3.6.0 branch change log if you want.
......
......@@ -816,9 +816,9 @@ class t3lib_parsehtml {
* @return string Processed HTML content
*/
function prefixResourcePath($main_prefix,$content,$alternatives=array()) {
$parts = $this->splitTags('td,table,body,img,input,form,link,script,a',$content);
reset($parts);
while(list($k,$v)=each($parts)) {
foreach($parts as $k => $v) {
if ($k%2) {
$params = $this->get_tag_attributes($v,1);
$tagEnd = substr($v,-2)=='/>' ? ' />' : '>'; // Detect tag-ending so that it is re-applied correctly.
......@@ -871,8 +871,22 @@ class t3lib_parsehtml {
}
}
}
$content = implode('',$parts);
// Fix <style> section:
$prefix = isset($alternatives['style']) ? $alternatives['style'] : $main_prefix;
if (strlen($prefix)) {
$parts = $this->splitIntoBlock('style',$content);
foreach($parts as $k => $v) {
if ($k%2) {
$parts[$k] = eregi_replace('(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))','\1'.$prefix.'\2\3',$parts[$k]);
}
}
debug($parts);
$content = implode('',$parts);
}
return implode('',$parts);
return $content;
}
/**
......
......@@ -2148,6 +2148,13 @@ class tslib_cObj {
if ($conf['workOnSubpart']) {
$content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
}
// Fixing all relative paths found:
if ($conf['relPathPrefix']) {
$htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
$content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
}
if ($content) {
if ($conf['nonCachedSubst']) { // NON-CACHED:
// Getting marks
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment