[TYPO3-core] RFC: Bug in tslib_content.

Bernhard Kraft kraftb at kraftb.at
Sun Apr 2 22:21:16 CEST 2006


Hello,


This is a CVS patch request.


I just found a bug in tslib_content. It only occurs when you use older versions
of CSS styled content.

You may ask why I want to use and old CSS_styled_content version. The answer is
simple: I need table-based layouts because the page-contents get generated into
.pdf's and "htmldoc" which does this job (using the "pdf_generator" extension)
is not able to understand CSS.

So when the old css_styled_content is installed and you want caption-split to work
again you need to take the TS-setup for it from the new version cause code in tslib_content
has changed.

But the old IMGTEXT method in tslib_content has problems setting the correct "IMAGE_NUM"
register value for the caption actually rendered. See the screenshot here:

http://think-open.org/kraftb/wrong_caption.png

The first and the second caption are identical (which shouldn't be the case) and 4th
"Geschütz aus dem 1. Weltkrieg" (Artillery from 1st worldwar) should be below the 3th
image.

The reason is obvious. An uninitalized variable get's used and $imgIndex contains
'' (false, NULL)
0
1
2

for 4 images.

See the attached patch.


Hope this makes it into RC3 still ... I'm available in #typo3-dev for questions.

----------------------------snip--------------------------
--- typo3_src-4.0rc2/typo3/sysext/cms/tslib/class.tslib_content.php 2006-03-26 22:22:16.000000000 +0200
+++ typo3_src-4.0rc2.mod/typo3/sysext/cms/tslib/class.tslib_content.php 2006-04-02 22:10:59.376491344 +0200
@@ -1038,8 +1038,8 @@
            if ($noCols)  {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}   // In case of "noCols" we must set the table-tag that surrounds the images in the row.
          }
          for ($a=0;$a<$rowCount_temp;$a++) { // Looping through the rows IF "noRows" is set. "noRows"  means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set.
-           $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;  // register previous imgIndex
            $imgIndex = $index+$a*$colCount_temp;
+           $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;  // register previous imgIndex
            if ($imgsTag[$imgIndex])  {
              if ($rowspacing && $noRows && $a) {   // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
                $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
----------------------------snip--------------------------



greets,
Bernhard
-- 
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tslibContent_captionSplit_2006-04-02.diff
Type: text/x-patch
Size: 1290 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060402/6cd3bdb9/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060402/6cd3bdb9/attachment.pgp 


More information about the TYPO3-team-core mailing list