Project

General

Profile

Actions

Bug #17412

closed

parseFunc tags.XXX for single tags doesn't work

Added by Ernesto Baschny over 16 years ago. Updated over 11 years ago.

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

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

parseFunc "tags" doesn't work if the tag is a single tag which has attributes. E.g. the following:

lib.parseFunc_RTE {
tags.img = TEXT
tags.img {
current = 1
case = upper
}
}

Won't handle: <img src="..." ... />
Will handle: <img/>
Will handle: <img src="..." ...></img>

So currently one cannot write a parseFunc for such an img tag.

This can be used for example for the click-enlarge rendering of images embedded in RTE, as Stanislau alterady added to rtehtmlarea code a year ago, but marked as "EXPERIMENTAL" because of this core bug. See related bug report #14605
(issue imported from #M5841)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #14605: Click-enlarge for ImagesClosedStanislas Rolland2005-03-12

Actions
Actions #1

Updated by Stanislas Rolland about 16 years ago

You may try the small patch attached to issue #0880. Let me know if it works for whatever you were trying to do.

Actions #2

Updated by Ernesto Baschny about 16 years ago

Hi Stanislas,

thanks for bringing this up again. I was trying to finally enable the click-enlarge in RTE while you were gone. :) My patch was already in core list (search for 5841), but wasn't approved. And your patch and mine had the same trouble that I only recognized later.

See discussion in core-list. My last post about it, no further feedback came in:

The problem I encountered was that it is difficult to differenciate a single tag (ends with "/") and a open/close tag in a TYPO-tag, which is not XML-conform.

E.g. this is valid for parseFunc processing:

<link http://www.typo3.org/&gt;Link&lt;/link>

but of course this is not XML. And the ending "/" in the opening <link> makes it very difficult to differenciate that from a single tag with parameters, e.g:

<img src="..." /> ...

This was broken with the previous patch (v2), as it broke all links which ended with "/".

In the new patch (attached, as v3) I do that with a regexp which expects at least one space before the closing "/".

Parsing single tags without attributes should have been possible with standard TYPO3 if the "/" is glued with the tag name:

a) &lt;br/> -> works because the "/" is the end of $tag0
b) &lt;br /> -> doesn't work, because "/" is in $tag1

Variant b) might work with my patch, I haven't tested.

Actions #3

Updated by Stanislas Rolland about 16 years ago

I updated the patch on issue 880.

Actions #4

Updated by Martin Holtz over 11 years ago

  • Target version deleted (0)

IMHO this is fixed already. I tested with 4.5.14:

page.10 = TEXT
page.10.value (
  <img>
  <img src="..." />
)
page.10.parseFunc {
  tags.img = TEXT
  tags.img {
    value = img!
  }
}

and i get:
img!
img!

In class tslib_content -> function _parseFunc($theValue, $conf) there is a part which deals with this issue:

if (!$currentTag && !$tag['out']) {
    $currentTag = $tag; // $currentTag (array!) is the tag we are currently processing
    $contentAccumP++;
    $treated = 1;
    // in-out-tag: img and other empty tags
    if (preg_match('/^(area|base|br|col|hr|img|input|meta|param)$/i', $tag[0])) {
        $tag['out'] = 1;
    }
}

So i guess, this issue can be closed.

Actions #5

Updated by Ernesto Baschny over 11 years ago

  • Category deleted (Communication)
  • Status changed from New to Closed

Good catch! :) Thanks!

Actions

Also available in: Atom PDF