[Typo3-dev] feature-patch for pi_list_browseresults

Michael H.E. Roth mher at mher.de
Tue Nov 2 22:42:40 CET 2004


Rainer Kuhn wrote:

> Hi Michael,
> 
> first of all: Congratulations for the birth of your son - all the best for 
> you and your family!  :-)
> 
Thank you very much!

> If you find some time for the less important things of life ;) , here are 
> the announced test results from my first test of your patch (the following 
> comments are pure "user test" results, I did not check the code).
> 
> 
>  > the additional 'internal'-array-elements are:
> 
> My environment: I used the pi_list_browseresults.flexible2u.patch in TYPO3 
> 3.6.1 and in my test extension I assigned the new $this->internal array 
> elements directly before calling $this->pi_list_browseresults()).
> 
> 
>  > $this->internal['pagefloat']
>  > (integer: number of page-links behind current page, if not set or negative:
>  > "traditional behaviour")
> 
> Setting this array element did not work as I expected.
> 
> Example 1: I have 26 list elements with results_at_a_time = 5 and 
> maxPages=5. When 'displaying 'results 1 to 5 out of 26' I got with the 
> "traditional behaviour":
> 
> Page 1  Page 2  Page 3  Page 4  Page 5  Next >
> 
> After setting $this->internal['pagefloat'] to 3, I got
> 
> Page 3  Page 4  Page 5  Next >
> 
> The link to 'Page 2' is never displayed - regardless on which page I've 
> been...
> 
> Example 2: Same configuration as above, but maxPages=10. The "traditional 
> behaviour" displayed the same result as above, and after setting 
> $this->internal['pagefloat'] to 3 nothing changed:
> 
> Page 1  Page 2  Page 3  Page 4  Page 5  Next >
> 
> Did I misunderstood something or is this _not_ the expected behaviour?
> 
Ooops, I think I found the reason for Example 1, and eliminated it.
Example 2 should have shown with or without pagefloat also Page 6
(ceil(26/5) results in 6, thus showing 0..5 (6 pages)

<snip desc="reoports about misbehaviour of 'showFirstLast' and
'showRange' if set to 0" />
> 

> OK, I had a quick look in the code now:
> 
> Patch line 94:
> if (isset($this->internal['showRange']) and
> $this->internal['showRange']=1) should be: if
> (isset($this->internal['showRange']) and
> $this->internal['showRange']==1)
>                                                                         ^^^^
> Same matter for lines 69, 76, 101, 108.

:-( embarassing (fixed that immediatly, and withdrew all old published
patches)
New Patch now: http://www.mher.de/pi_list_browseresults-3.0.0.patch.gz
(diff -u ...)
 
> 
> The additional meaning to the first parameter $showResultCount
> (mentioned in another branch of this thread) works fine.

At least something works.

> Testing the third parameter $wrapArr (also mentioned in the other branch
> of this thread) resulted sometimes in a "broken" display, e.g. with the
> following example displaying Page 1:
> 
> $wrapArr['disabledLinkWrap'] = '<div style="color:red">|</div>';
> $this->internal['showFirstLast'] = 1; $fullTable .=
> $this->pi_list_browseresults(1, '', $wrapArr);
> 
> The problem is that "|< First" and "< Previous" are no more members of
> the HTML table where the page links are contained in. Comparable effects
> with the other elements of $wrapArr...

This is intended behaviour, because otherwise you couldn't get rid of the
table layout. If you just want to change some part of the table layout you
have to keep its essitial markup, in your example:
$wrapArr['disabledLinkWrap'] = '<td nowrap="nowrap"><div
style="color:red">|</div></td>
should do the trick.

I think this needs more documentation with some examples.

One example (not meant as a working setup but for illustration purposes):
$wrapArr['browseBoxWrap'] = '<div class="browseBoxWrap">|</div>';
$wrapArr['showResultsWrap'] = "\n".'<div
class="showResultsWrap">|</div>'."\n"; $wrapArr['LinksWrap'] = '<div
class="LinksWrap">|</div>'."\n"; $wrapArr['showResultsNumbersWrap'] =
'<span class="showResultsNumbersWrap">|</span>';
$wrapArr['disabledLinkWrap'] = '<span class="disabledLinkWrap">|</span>';
$wrapArr['inactiveLinkWrap'] = '<span class="inactiveLinkWrap">|</span>';
$wrapArr['activeLinkWrap'] = '<span class="activeLinkWrap">|</span>'; 

$this->internal['showFirstLast'] is 1
$pointer is 0 (first page, therefore First and previous are disabled)
$showResultCount is 1
$maxPages is 3

 should result in something like:
<div class="browseBoxWrap">
<div class="showResultsWrap">Displaying <span
class="showResultsNumbersWrap">1</span> to <span
class="showResultsNumbersWrap">5</span> out of <span
class="showResultsNumbersWrap">26</span></div>
<div class="LinksWrap"><span class="disabledLinkWrap">|&lt;
First</span><span class="disabledLinkWrap">&lt; Previous</span><span
class="activeLinkWrap">Page 1</span><span class="inactiveLinkWrap">Page
2</span><span class="inactiveLinkWrap">Page 3</span><span
class="inactiveLinkWrap">Next &gt;</span><span
class="inactiveLinkWrap">Last &gt;|</span></div>
</div>

you are always just overwriting the complete wrapper for an element and it
has to fit into the nested structure of the rest.

I hope this clarifies some.

> I hope this helps - thanks for your work,

Thank YOU for your patience testing and digging into the sources

Michael
-- 
Michael H.E. Roth




More information about the TYPO3-dev mailing list